初阶版,接受并输出指令
#!/bin/bash
for args in $@
do
echo $args
done
进阶版,输入运行指令
#!/bin/bash
if [[$1 == 'start']]
echo 'start'
# commands
elif [[$1 == 'stop']]
echo 'stop'
# commands
else
echo "Please make sure the positon variable is start or stop."
fi
参考:
https://blog.csdn.net/goodlixueyong/article/details/6564591
https://blog.csdn.net/wangpengqi/article/details/10002327