[Sussex] BASH problem

Geoff Teale gteale at cmedltd.com
Mon Jul 14 11:45:04 UTC 2003


Morning all..

Just writing some bash script here this morning, what I need is for the shell 
variable $IFS to store the return character (commonly represented by \n ).

However, using "\n" means that loops will now break on instances of the letter 
'n' (unfortunate to say the least).  Putting in a literal return works but is 
very ugly to look at (see code snippet below):

tmp_IFS=$IFS
#OK, OK, this is _dirty_ there is a literal return here :(
IFS="
"

... Does anyone know of a neater way of doing this?

-- 
GJT
gteale at cmedltd.com





More information about the Sussex mailing list