I'm currently writing a script to help automate the task of adding accounts to our web server. This script will obviously need to run as root, and at one point I need to create a symlink in the new user's home directory. I don't want to hardcode /home into the script, so I tried using ~$1 (tilde) with no luck. It seems that the tilde expansion is actually a feature of bash, and though the command will expand to "ln -s /www/newuser ~newuser/www", the tilde will not be expanded to "/home/", which causes ln to complain that there is no such directory as "~newuser". Is there any way to retrieve the location of a user's home directory without using the tilde, or trick bash into expanding the tilde into the proper path (usually /home/)?
Any help appreciated. Thanks.