shell总结【第三篇】:shell脚本小技巧

1、脚本包含密码或者主机信息,执行完成以后自动删除脚本

rm -f  `pwd $(dirname $0)`/$0

 2、检查当前用户

# Check if user is root
if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script, please use root to install lnmp"
    exit 1
fi

 

posted @ 2016-08-02 13:41  每天进步一点点!!!  阅读(152)  评论(0编辑  收藏  举报