你做了什麼?
在這裡散播Arch神教都不會被ban(#
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
我不太懂 [ -z "${debian_chroot:-}" ] 為什麼要加上:-
感覺直接寫 [ -z "${debian_chroot}" ] 也是OK的啊
我好像理出點頭緒了 似乎跟nounset這個flag有關
我再自行試試好了 謝謝
$ echo $var
$ echo $?
$ set -u
$ echo $var
$ echo ${var:-}
謝謝 看來是為了避免nounset為on時發生錯誤才這樣寫
If the debian_chroot parameter is not set or empty AND the /etc/debian_chroot file is existing and readable then set the debian_chroot parameter's value as the content of /etc/debian_chroot
看起來的確是避免觸發 nounset 所以這樣設計的,早期版本的 bash 並不支援檢查 parameter 有無被設定