What is the fish shell equivalent to the following bash:
echo ${TEST:-1}
In bash this would print the value of TEST if there was one, or 1 if there was not.
fishshell
What is the fish shell equivalent to the following bash:
echo ${TEST:-1}
In bash this would print the value of TEST if there was one, or 1 if there was not.
Best Answer
I believe you need temponary variable (or a function). If
$TEST
doesn't exist, it's expanded to nothing, and$test_or
only contains1
. It would be nice to have real way of doing that, but currently the syntax is issue, and it doesn't appear it's really needed for most purposes.Also, if all you want is to modify
$TEST
if it doesn't exist already, you can useset -q
.