0

我正在尝试从file

> source ./rank file

使用这个脚本

set line = ($<)  <- inside rank

但是当我进入

echo $line我什么都没有收到,我该如何更改?提前致谢

4

3 回答 3

1

由于 csh 是脑死亡,你必须做这样的事情:

set line = `head -n 1 filename`
于 2010-05-31T14:12:59.977 回答
0
set line = `cat file | sed 1q`
于 2012-07-02T09:31:54.997 回答
0

它内置在 Bash 中:

read -r line < filename
于 2010-05-31T13:44:40.997 回答