frejac wrote:So...I googled some and found what seems to be a nice way to handle spaces.
Just add
- Code: Select all
IFS=$'\0'
somewhere before the for-loop.
edit: not sure exactly what it does, so it may break something else

IFS means Input Field Separator and is default a space. The IFS is an internal variable used in several bash functions, eg. "for i in" where the line is read word for word separated by a space, ie. the IFS.
You may set the IFS to anything you prefer to make it function to your needs but a good practice is to set it back to original before you end your script:
- Code: Select all
TMP_IFS=$IFS
IFS=";"
..do your thing
IFS=$TMP_IFS
I'm not sure what the code IFS=$'\0' actually means but $0 is always the script itself. $1 is input one, etc. Try echo $0 inside your script to see.
A very good source for more on bash functions is:
http://www.faqs.org/docs/abs/HTML/index.htmlFirst post, waiting for my ReadyNAS Duo to arrive! Can't wait to start "hacking"...
