w**********e 发帖数: 74 | 1 我不明白 为什么变量path 不能带到ls命令中
#!/bin/csh -f
set path=./cs111b
ls -l $path
echo path=$path
libra% aa
ls: Command not found
path=./cs111b
可以马上回答吗? 谢谢 | x******g 发帖数: 3952 | 2 After you set path to a new value, ls cannot be found there.
You need to either include the path where ls locates to path variable,
or prefix ls with path.
【在 w**********e 的大作中提到】 : 我不明白 为什么变量path 不能带到ls命令中 : #!/bin/csh -f : set path=./cs111b : ls -l $path : echo path=$path : libra% aa : ls: Command not found : path=./cs111b : 可以马上回答吗? 谢谢
| m*e 发帖数: 155 | 3 it is "Command" not found, not "path" not found.
try a different variable name from "path".
$path turns out to be used by shell to find all "Command"s,
therefore if you set it to ./cs111b, all you can execute are
shell build-ins plus executables in ./cs111b/ only.
【在 x******g 的大作中提到】 : After you set path to a new value, ls cannot be found there. : You need to either include the path where ls locates to path variable, : or prefix ls with path.
|
|