Search code examples
shellscriptingenvironment-variableshome-directorytilde-expansion

Why use $HOME over ~ (tilde) in a shell script?


Is there any reason to use the variable $HOME instead of a simple ~ (tilde) in a shell script?


Solution

  • Tilde expansion doesn't work in some situations, like in the middle of strings like /foo/bar:~/baz