I have these variables in my script:
TARGET=username
TARGET_DIR="~${TARGET}/.ssh"
I want the TARGET_DIR
var to hold this path: /home/username/.ssh
but to use ~
instead of /home/
.
But when I run the script and try to make new .ssh
dir under username it tells me:
mkdir: cannot create directory ‘~username/.ssh’: No such file or directory
Even though the /home/username dirs exists.
If I do: TARGET_DIR="/home/${TARGET}/.ssh"
it works.
How can I use the ~
sign in the variable?