运行 tcsh 文件时出现问题

运行 tcsh 文件时出现问题

我无法运行以下程序。当我尝试运行它时,它说

set goal = `head -c 15 < /dev/urandom | base64 | sed 's/[^0-9]//g' | sed'
Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].

我的程序代码如下:

#!/bin/tcsh -f
echo "guess the number"
set answer = $<
set goal = `head -c 15 < /dev/urandom | base64 | sed 's/[^0-9]//g' | sed 's/\(.\).*/\1/'` 
set count = 1
while ($answer != $goal )
   if ($answer < $goal ) then echo "too small"
   else
      echo "too large"
   endif
   @ count ++
   set answer = $<
end
echo "correct!"
echo "using $count rounds"

相关内容