Three commands that all print your home directory
Three commands that all print your home directory
Answer
echo $HOME echo ~ getent passwd "$(id -un)" | cut -d: -f6 cd && pwd
Four routes to one string. `$HOME` is a shell variable set at login; `~` is expanded by the shell from the same value; `getent` reads field 6 straight out of the password database, which is where the value came from in the first place; and `cd` with no argument goes home, so `pwd` then prints it.
Sarwar & Koretsky 3e ch4 §4.3, §4.4.3