I want to store a path I often use as an environment variable, then call this variable to construct a path name.
$ mypath="~/local/bin/"
$ newFile="${mypath}newFile.sh"
$ echo $newFile
~/local/bin/newFile.sh
That appears to work.
But, if I call $newFile as the input to touch, it fails:
$ touch $newFile
touch: ~/local/bin/newFile.sh: No such file or directory
$ touch "${mypath}newFile.sh"
touch: ~/local/bin/newFile.sh: No such file or directory
Both don't work. What am I missing?
P.S. I'm certain that this has been discussed already but I'm new to bash so I don't know what the jargon is to search yet. Thanks for any help.