给source script传递参数
# cat main.sh
set aaa bbb
. ./sub.sh #source script
# cat sub.sh
echo "1=$1"
echo "2=$2"
运行结果:
# sh ./main.sh
1=aaa
2=bbb
参考:
https://www.unix.com/unix-for-dummies-questions-and-answers/14855-arguments-sourcing-file.html
[
本帖最后由 linda 于 2024-11-26 10:00 编辑 ]
搜索更多相关主题的帖子:
linux shell source 脚本 script