在許多SO問題和bash教程我看到,我可以訪問命令行參數在bash腳本中有兩種方式:
$ ~ >cat testargs.sh
#!/bin/bash
echo "you passed me" $*
echo "you passed me" [email protected]
導致:
$ ~> bash testargs.sh arg1 arg2
you passed me arg1 arg2
you passed me arg1 arg2
$*
與[email protected]
有什麼區別?
什麼時候應該使用前者,何時使用後者?
看看這個答案:http://stackoverflow.com/a/842325/671366 – codeling
@nyarlathotep,謝謝,這個問題很有用。標題很糟糕。我永遠不會猜測答案顯示我在找什麼。不知何故,我的問題確實很微不足道,但是我在頭腦中制定它的方式在bash手冊中找不到(儘管/ *將您帶到了正確的地方......) – Oz123