
시도하면서 fish
다음의 일부 변수 확장에 해당하는 항목이 붙어 있습니다 bash
.
x=${this:-$that}
x=${this:-that}
물고기에서는 어떻게 해야 하나요?
답변1
posix 쉘 변수 확장만큼 짧은 것은 없습니다.
if set -q this; or test -z $this
set x $that
else
set x $this
end
또는 "간결한" 버전
begin; set -q this; or test -z $this; end; and set x $that; or set x $this
(나는 이것에 대해 틀렸다는 것을 증명하게 되어 기쁘다)