This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Need help with looping in Bash Shell Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Need help with looping in Bash Shell Script" Watch "Need help with looping in Bash Shell Script" New topic
Author

Need help with looping in Bash Shell Script

Kishen Singh Punjabi
Ranch Hand

Joined: Sep 14, 2012
Posts: 71
Hi,

I am storing the results from DB in an array.

For example ,

Records from DB are as follows:
This is Record One
This is Record Two


when I store the above records in a array and print , it is displayed something as follows:
This is Record One This is Record Two

and when I use for loop for this I get 8 elements with each record split into 4. I understand that this is because for loop takes space as the separator of elements in the array.

I want to store each record from the database as an element in array.

Please help on how do I achieve it. Thanks for the help!!



Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 563
Per this page, quoting allows embedding white space in array elements. There may be other helpful hints on that page if this one is not sufficient.


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with looping in Bash Shell Script
 
jQuery in Action, 3rd edition