I might be doing something wrong but it looks like variable expansion is not working for default values in my sell environment (Big Sur, Fish shell).
I have
-s --some-dir [arg] Location of directory. Default="${HOME}/some/dir"
Further down I have:
debug "arg_s: ${arg_s}"
debug "HOME: ${HOME}"
[[ -d "${arg_s:-}" ]] || {
error "No directory found at: ${arg_s:-}"
exit 1
}
Here is my output:
$ LOG_LEVEL=7 ./myscript -- test
[ debug] arg_s: ${HOME}/some/dir
[ debug] HOME: /Users/myusername
[ error] No directory found at: ${HOME}/some/dir
The interesting thing is that it really prints out ${HOME} instead of /Users/myusername.
However, when I use ${HOME} directly in the script it works.
One observation from my shell:
$ echo "${HOME}"
fish: Variables cannot be bracketed. In fish, please use "$HOME".
echo "${HOME}"
^
$ echo "$HOME"
/Users/myusername
I might be doing something wrong but it looks like variable expansion is not working for default values in my sell environment (Big Sur, Fish shell).
I have
Further down I have:
Here is my output:
The interesting thing is that it really prints out
${HOME}instead of/Users/myusername.However, when I use
${HOME}directly in the script it works.One observation from my shell: