Is there any reason to use the variable $HOME instead of a simple ~ (tilde) in a shell script?
$HOME
~
Tilde expansion doesn't work in some situations, like in the middle of strings like /foo/bar:~/baz
/foo/bar:~/baz