correct expansion of ~ char in a bash script
Posted on 2001-08-24
I'm writing a simple bash script to back up user accounts on a Linux machine. I want to pass the user name into the script as an argument and then expand it to the full home path for the user. In other words, I want to inside the
script do something like:
This style works fine in the script. However, I need to be able to pass the user name in as an argument, so I'm trying to do:
This doesn't expand correctly.
How do I get the desired expansion using the argument?