How to get the home directory from the user name in a variable in Bash?
You can use this Bash script snippet:
userhome=$(eval echo ~$user)
$user get evaluated to its value (say VALUE) and then
~VALUE will be evaluated again by
eval which gives the same effect as