t**********n 发帖数: 68 | 1 A simple C-script like blow:
Try to go through each directory and like the files under each list
But when I run the script
foreach a (`ls -d *`)
echo $a
cd $a
cd ..
end
The output is like:
^[[0m^[[01;34m2008.001^[[0m: No such file or directory.
cannot "cd" direcoty
but echo shows the right directory.
Anyone confronted this kind problem under ubuntu |
a9 发帖数: 21638 | 2 得用绝对目录吧
【在 t**********n 的大作中提到】 : A simple C-script like blow: : Try to go through each directory and like the files under each list : But when I run the script : foreach a (`ls -d *`) : echo $a : cd $a : cd .. : end : The output is like: : ^[[0m^[[01;34m2008.001^[[0m: No such file or directory.
|
v*s 发帖数: 29 | 3 用-d有意义吗
最好给出你alias命令的输出
确定你跑这个script的当前目录就是你想要运行的目录
【在 t**********n 的大作中提到】 : A simple C-script like blow: : Try to go through each directory and like the files under each list : But when I run the script : foreach a (`ls -d *`) : echo $a : cd $a : cd .. : end : The output is like: : ^[[0m^[[01;34m2008.001^[[0m: No such file or directory.
|
x****s 发帖数: 921 | 4 use /bin/ls
your ls has added color
【在 t**********n 的大作中提到】 : A simple C-script like blow: : Try to go through each directory and like the files under each list : But when I run the script : foreach a (`ls -d *`) : echo $a : cd $a : cd .. : end : The output is like: : ^[[0m^[[01;34m2008.001^[[0m: No such file or directory.
|