LinuxSA Mailing list archives
Index:
[thread]
[date]
[subject]
[author]
[stats]
From: Andrew McDonnell <andymc73@yahoo.com.au>
To : <linuxsa@linuxsa.org.au>
Date: Fri, 29 Jun 2001 11:32:35 +1000 (EST)
Re: for loop (bash) with spaces in filenames
On Thu, 28 Jun 2001 Benjamin Close wrote
<snipped>
> How about the simple approach where you tell the
> shell what to split on.
> ie:
> #!/bin/sh
> IFS=
> for i in `cat fred`
> do
> ....
>
>
> Note there is only a new line after the IFS=
> Which tells the shell to split only on new lines.
<snipped>
Confused; at first glance this sets IFS to nothing; eg
andrew@pd001738[bash]:~$ ABC=
andrew@pd001738[bash]:~$ echo X${ABC}X
XX
I found this in the bash manpage:
<quote>
The shell treats each character of IFS as a delimiter,
and splits the results of the other expansions into
words on these characters. If IFS is unset, or
its value is exactly <space><tab><newline>, the
default, then any sequence of IFS characters
serves to delimit words.
</quote>
There was some other stuff on IFS in arrays & $* etc
How do you get just the <cr> into the value of IFS?
I never seem to get the hang of inserting special
chars in Unix :-)>
Andrew
=====
-----------------------
www.comptroubsa.com
www.andrewmcdonnell.net
_____________________________________________________________________________
http://messenger.yahoo.com.au - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!
--
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject
Index:
[thread]
[date]
[subject]
[author]
[stats]
Return to the LinuxSA Mailing List Information Page