[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (none)
From: |
Chet Ramey |
Subject: |
Re: (none) |
Date: |
Thu, 6 Sep 2001 12:23:26 -0400 |
> This is really wierd, but I think I found a bug in bash. Any way I try
> and set IFS to a <newline> it crashes bash. I'm simply trying to iterate
> for each line in a file, so if there's a better way, let me know.
> Nevertheless, this is really strange to me.
>
> #for each line
> IFS='\n'
> for i in $1; do
> echo $i
> done
This script as written doesn't do at all what you think it does. It just
echos the script arguments, splitting them where they contain `\' or `n'.
If you want to iterate for each line in a file, use `read':
while read line
do
process line
done < file
How exactly does bash `crash'? Does it core dump?
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: (none),
Chet Ramey <=