Friday, November 16, 2007

bash echo problem with filenames with whitespaces

taken from http://textsnippets.com/posts/show/1105 --thanks so much guys

Bash Internal field seperator has to be changed to $'\n' like this

export IFS=$'\n'

now when u do
for i in `ls`;echo $i;done

spaces will not be treated as field seperators and consequently the whole filename is displayed completely.

No comments: