Assume someuser has a home directory /home/someuser
NAME=someuser
In bash - what expression to I use combining tilde (~) and $NAME to return the users home d
Tilde ( ~ ) it's the same as $HOME so, not all the user will have as root to home the same directory.
But if you insist in using the tilde this do the work:
echo ~/../$NAME
See:
$ pwd /home/oreyes $ export NAME=john $ export DIRECTORYNAME=~/../$NAME $ cd $DIRECTORYNAME $ pwd /home/john