Centos Linux 6.5 编写shell脚本
例题:
建立一个名为confighttp的shell脚本放置在用户主目录。该脚本的功能是打开编辑httpd.conf配置文件
解:
1.建立一个shell脚本文件(扩展名为.sh)
![](https://img-blog.csdnimg.cn/img_convert/bf4a4bd58bb3448db4b00cc06d5b7632.png)
2.编写内容
(shell脚本文件的开头必须是#/bin/sh +命令)
![](https://img-blog.csdnimg.cn/img_convert/eb23f72eb5004178aa2b1bc9b320e43b.png)
3.执行这个文件
![](https://img-blog.csdnimg.cn/img_convert/8d664c5cced74479a7dba997e1e86fd8.png)
成功打开
![](https://img-blog.csdnimg.cn/img_convert/fb9230198a99489abb20b9ed836ab090.png)
例题:
建立一个名为confighttp的shell脚本放置在用户主目录。该脚本的功能是打开编辑httpd.conf配置文件
解:
1.建立一个shell脚本文件(扩展名为.sh)
2.编写内容
(shell脚本文件的开头必须是#/bin/sh +命令)
3.执行这个文件
成功打开