shell 如何解决这个未知的语法错误“near unexpected token '('"?

68bkxrlz  于 2022-11-25  发布在  Shell
关注(0)|答案(1)|浏览(152)

当在Mac终端上运行时,我得到以下错误:

syntax error near unexpected token `('

这是引发错误的行:

set mpr = (cat $dat | grep "256 256 128" |grep ok | awk '{print  $8}') echo "found mprages, $mpr"

如何解决这个语法错误?非常感谢!
完整的代码为:

set s = $1
SUBJECTS_DIR= <path>
export SUBJECTS_DIR
set log = $SUBJECTS_DIR/recon-all-commands.log
set dcmdir = <path>
set subjid = echo $s |gawk -F- '{print $2}'

if (-e $dcmdir/$s/scan.log) then

 . echo "found scan.log, finding mprages" set dat = $dcmdir/$s/scan.log

else

 . echo "no scan.log"

endif

set mpr = (cat $dat | grep "256 256 128" |grep ok | awk '{print  $8}') echo "found mprages, $mpr"

echo recon-all -i $dcmdir/$s/$mpr -all -s $subjid >> $log
kkbh8khc

kkbh8khc1#

Shell版本不兼容使用命令ls -al /bin/sh获取版本
解决方法:

$ sudo dpkg-reconfigure dash

然后选择否或“否”,并确认。

相关问题