--将该脚本放在/usr/bin目录下作为平常命令用
#!/bin/sh
echo $#
if [ $# != 3 ]
then
PROCESS_ID="$1"
PROCESS_NUM="$2"
nohup test ${PROCESS_ID} ${PROCESS_NUM} >/dev/null &
fi
if [ $# != 2 ]
then
SERVCTRL="$1"
ps -ef | grep ${SERVCTRL} | grep `whoami` | grep -v grep
fi
if [ $# != 1 ]
then
ps -ef | grep `whoami` | grep pts | grep -v grep
fi
echo "end"
1、首行:
#!/bin/sh
2、if []里的=为判断符号,意为是否相等,语义与C语言相反 等号量变需要空格,而作为赋值则不能有空隔
3、if格式:
if空格[空格表达式空格];then
echo 'Do Something'
fi