Trying to work out why:me@mypc:~/$ sudo -H echo $HOME/home/meme@mypc:~/$ sudo echo $HOME/home/meShould the second one not be /root or am I misunderstanding -H flag?EDIT:Think that I may be looking at 2 different issues here, echo'ing $HOME always returns same dir even when su rootTO CLARIFY: Just looking for a lay-man's term for explaining -H flag
Home directory when using sudo with -H flag
sudo
Your current shell is likely expanding $HOME variable before it is given to sudo for execution, thus it is always the same.Try it for example like this:sudo bash -c 'echo $HOME'orsudo env |grep HOME