Linux Shell
推荐格式:
#!/bin/bash
predir=`pwd` # 脚本运行目录
dir=`dirname $0` # 脚本所在目录
cd "${dir}"
# do your work
cd "$predir"
Case用法
case "$1" in
start)
sh /path/to/your/code/startup.sh
;;
stop)
sh /path/to/your/code/shutdown.sh
;;
restart)
sh /path/to/your/code/shutdown.sh
sleep 10
sh /path/to/your/code/startup.sh
;;
*)
echo "Usage: $0 (start|stop|restart)"
esac
判断空字符串:
if [ -n "$comment" ]:then
git add --all .
git commit -m "$comment"
git push origin master
else
# empty
echo "nothing modified"
fi
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 using1174@foxmail.com
文章标题: Linux Shell
文章字数: 103
本文作者: Jun
发布时间: 2019-08-29, 11:57:00
最后更新: 2021-06-27, 21:55:55
原始链接: http://yoursite.com/2019/08/29/Linux-Shell/版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。