csh: while read
Is there an equivalent in csh to bash's while read variable list?
|
AFAIK, the answer is no.
|
Well, I had to do it with a rather long trick:
say, in bash: Code:
cat /etc/passwd | while read blah; do Code:
set lines=`cat /etc/passwd` |
Or something like:
Code:
foreach line ( "`cat /etc/passwd`" ) |
That's right, but in my case I had two variables to get from every line, so I couldn't use the foreach and had to go with the while instead.
|
In C-shell it's not possible to read multiple variables, but you can do a trick like this:
Code:
foreach line ( "`cat file`" ) |
This should work for /etc/passwd:
Code:
foreach line ( "`cat /etc/passwd`" ) |
All times are GMT -5. The time now is 06:45 PM. |