随笔分类 -  Shell

摘要:参数: -n 不执行脚本,仅检查语法是否错误 -v 将脚本内容输出到屏幕上,然后执行脚本 -x 执行脚本,并将内容输出到屏幕 -n [root@new sbin]# sh -n debug.sh [root@new sbin]# -v [root@new sbin]# sh -v debug.sh 阅读全文
posted @ 2016-08-21 02:30 头痛不头痛 阅读(389) 评论(0) 推荐(0) 编辑
摘要:1.打印出彩色的格式 [root@new sbin]# cat demo.sh #/bin/bash . /etc/init.d/functions read -p "Pleas input your anwser[yes/no]: " an if [[ $an = yes ]] then acti 阅读全文
posted @ 2016-08-21 00:50 头痛不头痛 阅读(383) 评论(0) 推荐(0) 编辑
摘要:if 条件语句 if [[ $1 = start ]];then echo start app elif [[ $1 = stop ]];then echo stop appelif [[ $1 = ... ]];then.... else echo Please input command! fi 阅读全文
posted @ 2016-08-11 23:55 头痛不头痛 阅读(254) 评论(0) 推荐(0) 编辑
摘要:在bash中可利用let,(())和[]执行基本的操作,高级操作将会使用expr和bc 运算符:+,—,*,/,**(幂) (()) [root@Director ~]# ((c=2**3-9%2));echo $c 7[root@Director ~]# c=$((2**3-9%2));echo 阅读全文
posted @ 2016-08-07 00:28 头痛不头痛 阅读(179) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
主题色彩