随笔分类 - Shell
摘要:参数: -n 不执行脚本,仅检查语法是否错误 -v 将脚本内容输出到屏幕上,然后执行脚本 -x 执行脚本,并将内容输出到屏幕 -n [root@new sbin]# sh -n debug.sh [root@new sbin]# -v [root@new sbin]# sh -v debug.sh
阅读全文
摘要: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
阅读全文
摘要:if 条件语句 if [[ $1 = start ]];then echo start app elif [[ $1 = stop ]];then echo stop appelif [[ $1 = ... ]];then.... else echo Please input command! fi
阅读全文
摘要:在bash中可利用let,(())和[]执行基本的操作,高级操作将会使用expr和bc 运算符:+,—,*,/,**(幂) (()) [root@Director ~]# ((c=2**3-9%2));echo $c 7[root@Director ~]# c=$((2**3-9%2));echo
阅读全文
