0

大家好,我有 3 个文件:引擎脚本

#! /bin/tcsh -f

cat $1 |./hello

你好脚本

#! /bin/tcsh -f

set line1 = ($<)

    while (${#line1} != 0)
     set line2 = ($<)
     set first1 = $line1[1]
     set first2 = $line2[1]
     if( $first1 == $first2) then
      echo $first1 $line1[2] $line2[2]
      set line1 = ($<)
     else                 
      echo $first1 $line1[2] 0
      set line1 = $line2     <- problem here, but why?
     endif
    end   

输入文件

mba 30
mba 70
er 10
er 90
ma 20
ma 80
mt 100
al 35
al 65
eg 100
el 100
ez 10
ez 90
an 100
ews 30
rews 70
ar 23
ar 77
esa 45
esa 55

我的脚本似乎是正确的,但我收到一个错误:

mba 30 70
er 10 90
ma 20 80
mt 100 0
set: Variable name must begin with a letter.

任何想法为什么?提前致谢

4

1 回答 1

1

我找到了:set line1 = ($line2)正确答案

于 2010-10-04T10:58:17.190 回答