"for" and line by line

From: Markus Wenke (M.Wenke_at_web.de)
Date: 10/29/04


Date: Fri, 29 Oct 2004 09:27:13 +0200

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?

Thanks in advance

Markus Wenke



Relevant Pages

  • Re: Input Redirection for cat
    ... > and echo out the contents of the files contained in the list. ... > Is there a way to have a command operate on files that are in a ... Here's one (bash): ... for file in $(cat list.txt); do cat $file; done ...
    (comp.unix.questions)
  • re-direction and pipe, ask again
    ... I have another confusion about redirection and pipe on BASH. ... Cat the_file | read aa ... Echo $aa ... But for the following command, ...
    (comp.unix.shell)
  • Re: "for" and line by line
    ... On 2004-10-29, Markus Wenke wrote: ... > echo $LINE ... > the bash can't read the command. ...
    (comp.unix.shell)
  • Re: last exit status
    ... Markus Wenke wrote: ... > I want to get the exit status, of the last command, that have been started. ... > Is there a variable in bash, ...
    (comp.unix.shell)
  • Re: USB neu starten
    ... PCI Interrupt Link enabled at IRQ 7 ... bash: SLPB: command not found ... bash: syntax error near unexpected token `supports' ... achim@achim:~$ ReiserFS: hdc5: found reiserfs format "3.6" with standard journal ...
    (de.comp.os.unix.linux.hardware)