問題:
I want my script to be able to take an optional input,我希望我的腳本能夠接受一個可選的輸入,
eg currently my script is例如目前我的腳本是
#!/bin/bash
somecommand foo
but I would like it to say:但我想說:
#!/bin/bash
somecommand [ if $1 exists, $1, else, foo ]
解決方案:
參考一: https://en.stackoom.com/question/d9t4參考二: https://stackoom.com/question/d9t4