首页 > 系统服务 > 详细

1.2-shell结构以及执行

时间:2015-07-27 16:33:07      阅读:137      评论:0      收藏:0      [点我收藏+]

shell是按照脚本命令,顺序执行。

#!/bin/bash或#!/bin/sh              /bin/sh是/bin/bash的软链接

##描述信息

ls /etc/

echo "this is a test script"

wq保存退出,文件名为test.sh   不一定要.sh结尾,主要是为了区别和维护。

2种执行方法:

1:bash test.sh    或sh test.sh

   bash -x test.sh  -x用来跟踪脚本执行过程中的状态,利于排错。

2:chmod a+x test.sh      给文件赋予执行权限

   ./test.sh     或绝对路径 /root/test.sh


1.2-shell结构以及执行

原文:http://llzdwyp.blog.51cto.com/6140981/1678747

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!