a solution might be to install bash (just to be sure, it's there) and run scripts in bash instead of shell
another solution is universal: `userHome=$(sudo su <user_name> -c 'echo $HOME')