• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with looping in Bash Shell Script

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!



 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic