Re: tcsh read loop

From: Bruce Barnett (spamhater103+U040912213736_at_grymoire.com)
Date: 09/13/04


Date: 13 Sep 2004 01:39:08 GMT

Christopher W Aiken <chris@nospam.net> writes:

> In sh/bash I can use a loop like this to process text lines:
>
> while read line
> do
> echo $line
> ...
> ...
> ...
> done < some_text_file.txt
>
>
> Can this type of loop, that reads a complete line from a file, be done in
> csh/tcsh? How?

Only if the file you are reading is STDIN.

http://www.grymoire.com/Unix/CshTop10.txt - Top 10 reasons not to use the C shell.
This is reason #5.

You have to split this script into smaller scripts, and change STDIN.

-- 
Sending unsolicited commercial e-mail to this account incurs a fee of 
$500 per message, and acknowledges the legality of this contract.


Relevant Pages

  • Re: tcsh read loop
    ... >> echo $line ... >> Can this type of loop, that reads a complete line from a file, be done in ... > You have to split this script into smaller scripts, and change STDIN. ...
    (comp.unix.shell)
  • Re: Variables not passed out of WHILE
    ... that values of a string are not passed out of a WHILE ... loop. ... My script will not ECHO the value of $var at the end. ...
    (comp.unix.shell)
  • Re: renaming files via shell script
    ... what I meant by somefile. ... echo "in for loop" ... I get 'in script' but not 'in for loop'. ...
    (comp.os.linux.misc)
  • Re: How to get an interation count from a while loop (bash)
    ... I am trying to count how many times a while loop iterates. ... echo Total Lines Read is $LOOP_COUNT ... The usage for this script is ... The usage for the above script is: ...
    (comp.os.linux.misc)
  • Re: How do I get this out?
    ... There are so many ways to retirve information from a database. ... I use a loop for the most of the time. ... echo $linkage; ... I've edit the script a bit and got rid of some of the complex scripts ...
    (alt.php)