[Wolves] Arrays within Bash
Simon Burke
simonb at fatsportsman.eu
Thu Jul 28 10:52:29 UTC 2011
Hi guys,
The list has been quiet this recently so I thought I'd put forward
this conundrum.
I have a file that is formatted in a similar fashion to:
BP1_FS1='bp1_usr /usr/BP1'
BP1_FS2='bp1_mnt /mnt/BP1'
BP1_FS3='bp1_ora /oracle/BP1'
BP1_FS4='bp1_data /oracle/BP1/data'
The problem is that I need to loop through all the items that start
with BP1_FS in another script. I have tried to pull them out into an
array so I can loop through them, but the problem I am having is that
the the records in the array are being split into "'bp1_usr"
"/usr/BP1" and so forth.
It seems to be splitting the records at any occurance of a space, but
I need that space left in, and for everything in the quote marks to be
a separate records.
Can anyone suggest either a better way of doing this, or how I can get
around my array problem. Please note that although I'd like to just
use python, it has to be a bash script.
Regards,
Simon.
More information about the Wolves
mailing list