Tilde Substitution
After alias substitution is performed, each word is checked to see if it begins with an unquoted ∼. For tilde substitution, word also refers to the word portion of parameter expansion (see Parameter Expansion below). If it does, then the word up to a / is checked to see if it matches a user name in the password database (often the /etc/passwd file). If a match is found, the ∼ and the matched login name are replaced by the login directory of the matched user. If no match is found, the original text is left unchanged. A ∼ by itself, or in front of a /, is replaced by $HOME. A ∼ followed by a + or - is replaced by the value of $PWD and $OLDPWD respectively.
In addition, when expanding a variable assignment, tilde substitution ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access