目錄
如果 logfile 值已經存在側不會覆蓋
$ logfile=/var/log/test.log $ echo $logfile /var/log/test.log $ logfile=${logfile:-/tmp/test.log} $ echo $logfile /var/log/test.log
如果變數為空才能設置
$ unset logfile $ logfile=${logfile:-/tmp/test.log} $ echo $logfile /tmp/test.log
$ unset logfile