脚本 -- ./test start 是如何实现的

test.sh

#! /bin/sh
echo 'success' $1

执行 ./test.sh start ,输出的结果就是 success start。如此,start 就作为参数传递进脚本了

test.sh

#! /bin/sh
echo 'success' $2

./test.sh 1 的输出结果仍为 success,但如果 ./test.sh 1 2,输出结果为 success 2

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章