zsh - Append to variable filename in Bash -
why work:
echo "foo" >> ~/desktop/sf-speedtest-output.csv
but not?
outputfile="~/desktop/sf-speedtest-output.csv" echo "foo" >> $outputfile # error: no such file or directory
i have tried in ${}
, $()
, ""
. not escaping issue?
~
-expansion won't happen inside quoted string. can away this:
outputfile=~/"desktop/..."
or this:
outputfile="$home/desktop/..."
see tilde expansion or bash manual more details.
Comments
Post a Comment