$HOME is a Linux bash shell variable. It indicates the home directory of the current user; the default argument for the cd command. The value of this variable is also used when performing tilde expansion. Do not change the value of $HOME.
See the current value of $HOME
printf "%s\n" $HOME
Use the current value of $HOME in your shell script
Creating and setting $HOME within a script is fairly simple. Use the following syntax:
#!/bin/bash mysweethome="$HOME" echo "Your home directory is located at $HOME"