作为 Linux 用户,我一直只使用 bash,因为它是我使用的每个发行版的默认设置。使用其他 Unix 系统(如 BSD)的人似乎更频繁地使用其他 shell。为了多学习一点,我决定尝试一下 zsh。
作为 bash 用户:
我正在尝试使用此脚本:
#!/bin/csh
foreach SUB (1 2 3 4 5 6 7 8 9 10 11 12 13 14)
echo $SUB
foreach VISIT (1 2 3 4 5 6 7 8)
echo $VISIT
grep 'StudyDate' -f /home/colourlab/Desktop/DrummingDTI/D${SUB}/D${SUB}V${VIS}/scout/001/infodump.dat
done
done
Run Code Online (Sandbox Code Playgroud)
但每次我收到此错误消息时:
1
1
SUB: Undefined variable.
Run Code Online (Sandbox Code Playgroud)
我不知道为什么。