腳本 -- ./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

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