shell --- 入参

命令行入参,执行 ./build.sh XXX,则$0是 ./build.sh,$1是 XXX

 

$#:shell 或函数的入参个数,如 func a,则 $#=1

$@:shell 或函数的全部入参内容,如 func a b,则$@=a b

${1:-aaa}:shell 或函数的第一个参数如果没有设置,则使用默认值aaa

posted @ 2024-05-24 18:07  流水灯  阅读(26)  评论(0编辑  收藏  举报