space char shell script problem

Robert Huff roberthuff at rcn.com
Sat Aug 23 13:08:18 UTC 2008


RW writes:

>  > I am running into a problem with the space character in filenames.
>  > For instance, If I want to run the script;
>  > 
>  > for x in `ls`
>  > do
>  >   echo $x
>  > done
>  
>  for x in *

	There's the (poorly documented, IMO) IFS (internal field
separator) shell variable.  It's a string, normally set to space and
tab; set it to newline and good things can happen.


				Robert Huff



More information about the freebsd-questions mailing list