为什么遇到有空格的文件名就报错呢?
for file in `find . -type f` ; echo "$file" ;do chmod a-x "$file"; done
bash: 在未预料的“echo”附近出现语法错误
这是怎么回事?
for file in `find . -type f` ;do chmod a-x "$file"; done
- wzssyqa
- 帖子: 4010
- 注册时间: 2008-04-07 17:36
- 来自: 泰安人在阜新
for file in `find . -type f` ;do chmod a-x "$file"; done
宇宙=数学 *物理 sssssssss Ubuntu 桌面培训 sssssssss 问打包的问题之前先看
和我一样的新手请看,我看过了,腰不酸了,腿不疼了,上楼也有劲了
想去IRC的点这里——一个比QQ群好N多的东西
和我一样的新手请看,我看过了,腰不酸了,腿不疼了,上楼也有劲了
想去IRC的点这里——一个比QQ群好N多的东西
- cnkilior
- 论坛版主
- 帖子: 4984
- 注册时间: 2007-08-05 17:40
Re: for file in `find . -type f` ;do chmod a-x "$file"; done
代码: 全选
for file in `find . -type f` ; do echo "$file" ; chmod a-x "$file"; done
-
- 帖子: 627
- 注册时间: 2008-11-08 18:34
Re: for file in `find . -type f` ;do chmod a-x "$file"; done
#!/bin/bash
find . -type f|while read i;
do
echo "${i}"
chmod a-x "$i" ;
done
使用for来读入文件里的行时,会自动把空格和换行符作为一样分隔符,so...换while
注意格式,要么换行,要么象楼上加分号
find . -type f|while read i;
do
echo "${i}"
chmod a-x "$i" ;
done
使用for来读入文件里的行时,会自动把空格和换行符作为一样分隔符,so...换while
注意格式,要么换行,要么象楼上加分号
气血鼓荡,身体发胀,偶飘上头,三时舒畅
- 543082593
- 帖子: 234
- 注册时间: 2008-11-07 8:41
Re: for file in `find . -type f` ;do chmod a-x "$file"; done
很显然啊 没有wzssyqa 写了:为什么遇到有空格的文件名就报错呢?
for file in `find . -type f` ; echo "$file" ;do chmod a-x "$file"; done
bash: 在未预料的“echo”附近出现语法错误
这是怎么回事?
do for语句一定不要忘记了 do啊
fall again
smooth criminal
they don't care about us
billie jean
beat it
dangerous
the lost children
childhood
ben
i will be there
speechless
she is out of my life
rock with you
...
LOVE U FOREVER
smooth criminal
they don't care about us
billie jean
beat it
dangerous
the lost children
childhood
ben
i will be there
speechless
she is out of my life
rock with you
...
LOVE U FOREVER
- hubert_star
- 论坛版主
- 帖子: 5373
- 注册时间: 2007-10-29 22:12
- 系统: OSX 10.9 + Ub 1304
- 来自: 江苏南京
Re: for file in `find . -type f` ;do chmod a-x "$file"; done
chmod a+X or chmod a+x?
没去man过chmod?
没去man过chmod?
佛经说,人有八苦: 生、老、病、死、求不得、怨憎、爱别离、五阴盛 故我苦!
圣经说,人有七罪: 饕餮、贪婪、懒惰、淫欲、傲慢、嫉妒和暴怒 故我有罪!
我这篇帖子里面没有任何攻击我们伟大的中华人民共和国政府和任劳任怨的人民公仆(和本论坛高素质的版主)的文字和含义;
特此声明!
有些事,我们明知道是错的,也要去坚持,因为不甘心;有些人,我们明知道是爱的,也要去放弃,因为没结局;有时候,我们明知道没路了,却还在前行,因为习惯了。
欢迎来我的新浪微博@me
圣经说,人有七罪: 饕餮、贪婪、懒惰、淫欲、傲慢、嫉妒和暴怒 故我有罪!
我这篇帖子里面没有任何攻击我们伟大的中华人民共和国政府和任劳任怨的人民公仆(和本论坛高素质的版主)的文字和含义;
特此声明!
有些事,我们明知道是错的,也要去坚持,因为不甘心;有些人,我们明知道是爱的,也要去放弃,因为没结局;有时候,我们明知道没路了,却还在前行,因为习惯了。
欢迎来我的新浪微博@me