Re: "for" and line by line
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 10/29/04
- Next message: Markus Wenke: "stdout from shellscript"
- Previous message: Markus Wenke: ""for" and line by line"
- In reply to: Markus Wenke: ""for" and line by line"
- Next in thread: Ed Morton: "Re: "for" and line by line"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Oct 2004 07:34:21 GMT
On 2004-10-29, Markus Wenke wrote:
> Hi,
>
> I want to write a "for"-loop in bash such like this one:
>
> for LINE in `cat /etc/passwd`; do
> echo $LINE
> done
>
> But I get every word, and not every line. and if I set "IFS=^M" like this:
>
>
> IFS=[CTRL V][ENTER] for LINE in `cat /etc/passwd`; do
> echo $LINE
> done
>
> the bash can't read the command.
>
> How can I realise it?
while IFS= read -r LINE
do
echo $LINE
done < /etc/passwd
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
===================================================================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: Markus Wenke: "stdout from shellscript"
- Previous message: Markus Wenke: ""for" and line by line"
- In reply to: Markus Wenke: ""for" and line by line"
- Next in thread: Ed Morton: "Re: "for" and line by line"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|