views:

53

answers:

2

I'm trying to read first row from the file

> source ./rank file

using this script

set line = ($<)  <- inside rank

but when I enter

echo $line I receive nothing, how can I change it? thanks in advance

A: 

It's built-in in Bash as:

read -r line < filename
Jonas Elfström
Not in csh or tcsh.
Dennis Williamson
Thanks, added clarification that my answer was for Bash.
Jonas Elfström
how can I do it in csh?
lego69
`set line=\`head -n 1 filename\``
Jonas Elfström
A: 

Since csh is brain-dead, you'll have to do something like this:

set line = `head -n 1 filename`
Dennis Williamson