且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在shell脚本中使用别名?

更新时间:2023-12-05 19:04:22

source 你的脚本,不要像 ./foo.sh 那样执行sh foo.sh

source your script, don't execute it like ./foo.sh or sh foo.sh

如果你这样执行你的脚本,它会在子 shell 中运行,而不是你当前的.

If you execute your script like that, it is running in sub-shell, not your current.

source foo.sh  

对你有用.