logoalt Hacker News

SoftTalker • today at 3:33 PM • 1 reply • view on HN

I never use tilde in scripts, only as a convenience when typing commands interactively.

$HOME otherwise, which still has gotchas but they are the same as any other environment variable.


Replies

ndegruchy • today at 4:30 PM

Yeah, in scripts I try to be as explicit as possible. `$HOME` for the home directory, `$XDG_DATA_HOME` for `/home/foo/.local/share/`, etc.

The more specific you are, the less gotchas you're going to fall to.