Redian新闻
>
一个初级的shell scripting问题
avatar
一个初级的shell scripting问题# Unix - 噫吁兮,危乎高哉
y*g
1
我想对一个目录结构下的所有文件(不包括子目录本身)递归的执行
"chmod 744 *"
该如何写呢?
先谢过!
avatar
t*q
2
foreach file `find . -type f -print`
chmod 744 $file
end
somthing like this, not test

【在 y*****g 的大作中提到】
: 我想对一个目录结构下的所有文件(不包括子目录本身)递归的执行
: "chmod 744 *"
: 该如何写呢?
: 先谢过!

avatar
i*e
3
I think a single command line will do the job:
find your-directory-name -type f -exec chmod 744 {} \;

【在 y*****g 的大作中提到】
: 我想对一个目录结构下的所有文件(不包括子目录本身)递归的执行
: "chmod 744 *"
: 该如何写呢?
: 先谢过!

avatar
t*q
4

^
a space is needed as I think.

【在 i***e 的大作中提到】
: I think a single command line will do the job:
: find your-directory-name -type f -exec chmod 744 {} \;

avatar
i*e
5

actually you can't put a space there. that command returns an error
if there's a space there.

【在 t******q 的大作中提到】
:
: ^
: a space is needed as I think.

avatar
k*y
6
chmod -R

【在 y*****g 的大作中提到】
: 我想对一个目录结构下的所有文件(不包括子目录本身)递归的执行
: "chmod 744 *"
: 该如何写呢?
: 先谢过!

avatar
c*t
7
744 would forbid entering of the directory by others.

【在 k**y 的大作中提到】
: chmod -R
avatar
i*e
8
this will change the mode of subdirectories themselves as well,
making others unable to enter those subdirectories.

【在 k**y 的大作中提到】
: chmod -R
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。