用户工具

站点工具


侧边栏

[侧边栏]

report

侧栏编辑 后台管理
GIT仓库
老web
C++Reference
快速笔记 笔记浏览

working:7_随笔随记:未整理:shell:判断source运行

if [ "$0" == "${BASH_SOURCE[0]}" ] ; then
	echo -e "\033[1;31m[ERROR] Using the shell \"source\" command to this script.\033[0m \033[0;33mexample: source ${BASH_SOURCE[0]}\033[0m";
else
  echo "NOT NULL"
fi


test "$BASH_SOURCE" = "" && echo "This script only can be run from bash" && return
SCRIPT_SOURCE=$BASH_SOURCE
test "$SCRIPT_SOURCE" = "$0" && echo "Script is being run, should be sourced" && exit 1

working/7_随笔随记/未整理/shell/判断source运行.txt · 最后更改: 2021/01/20 02:35 由 wenliang