码迷,mamicode.com
首页 > 系统相关 > 详细

shell编程实例1

时间:2016-01-29 16:27:14      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

1、vim hello.sh

2、

#!bin/bash
echo "hello world!"

3、chmod +x  hello.sh

4、source hello.sh

 

ls -l 可以看文件的权限

用chmod 修改文件的权限

chmod u+x hello.sh

chmod u-r hello.sh

chmod u=rwx,g=rx,o=x file 

其语法格式为:chmod [who] [opt] [mode] 文件/目录名 

其中who表示对象,是以下字母中的一个或组合:

u:表示文件所有者
g:表示同组用户
o:表示其它用户
a:表示所有用户
opt则是代表操作,可以为:
+:添加某个权限
-:取消某个权限
=:赋予给定的权限,并取消原有的权限
而mode则代表权限:
r:可读
w:可写
x:可执行

总结:在echo 后面一定要加空格,否则执行程序没反应

shell编程实例1

标签:

原文地址:http://www.cnblogs.com/yygsj/p/5169068.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!