由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - Ubuntu 下 foreach(`ls -d xxx`) 不能work
相关主题
能MV/CP但不能执行如何在bash里backup所有checkout的文件?
ubuntu下怎么sync and backup files ?问个关于find 的问题
ubuntu里怎么回复default字体/appearancegnome下面如何该一类文件的icon?
ask one command in ubuntuLinux 下PHP是否可以取得windows Active Directory
A simple Bash question about changing directory怎么搞个简单的虚拟机?
Perl问题求助何种软件可以帮助生成文件目录结构图?
scp 选择性的转移某些文件,怎么操作?这个可能是什么问题
perl $_ questionSamba4 includes full Active Directory schema
相关话题的讨论汇总
话题: ubuntu话题: foreach话题: ls话题: directory话题: 0m
进入Linux版参与讨论
1 (共1页)
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.

1 (共1页)
进入Linux版参与讨论
相关主题
Samba4 includes full Active Directory schemaA simple Bash question about changing directory
root file system 和kernel有什么不一样吗?Perl问题求助
rsync 20G的home directory要多长时间scp 选择性的转移某些文件,怎么操作?
autocompletion in Bashperl $_ question
能MV/CP但不能执行如何在bash里backup所有checkout的文件?
ubuntu下怎么sync and backup files ?问个关于find 的问题
ubuntu里怎么回复default字体/appearancegnome下面如何该一类文件的icon?
ask one command in ubuntuLinux 下PHP是否可以取得windows Active Directory
相关话题的讨论汇总
话题: ubuntu话题: foreach话题: ls话题: directory话题: 0m