|
发表于 2004-3-20 03:18:17
|
显示全部楼层
javalee兄, 我试了你的script后不成功, 输出为:
[root@localhost shell_scripts]# ls
aa dir1 dir2 dir3 test 1 test 2 test 3
[root@localhost shell_scripts]# ls | while read i; do mv $i $(echo $i|tr -d ' '); done
mv: `aa' and `aa' are the same file
mv: cannot move `dir1' to a subdirectory of itself, `dir1/dir1'
mv: cannot move `dir2' to a subdirectory of itself, `dir2/dir2'
mv: cannot move `dir3' to a subdirectory of itself, `dir3/dir3'
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
[root@localhost shell_scripts]# ls
aa dir1 dir2 dir3 test 1 test 2 test 3
是什么原因呢? 我在另台机上试, 还出现了"mv: cannot stat `\033[00;34m.\033[00m/` 的奇怪报错. dearvold 兄的script也很简捷, 用pattern更换就把问题解决了. 目录结构如上所示, 有dir, 有空格文件名, 有正常文件名. |
|