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