Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Note that <a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01">POSIX</a> specifies the semantics of tilde expansion:</p> <blockquote> <h3>2.6.1 Tilde Expansion</h3> <p>A "tilde-prefix" consists of an unquoted <code>&lt;tilde&gt;</code> character at the beginning of a word, followed by all of the characters preceding the first unquoted <code>&lt;slash&gt;</code> in the word, or all the characters in the word if there is no <code>&lt;slash&gt;</code>. In an assignment (see XBD Variable Assignment ), multiple tilde-prefixes can be used: at the beginning of the word (that is, following the <code>&lt;equals-sign&gt;</code> of the assignment), following any unquoted <code>&lt;colon&gt;</code>, or both. A tilde-prefix in an assignment is terminated by the first unquoted <code>&lt;colon&gt;</code> or <code>&lt;slash&gt;</code>. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the <code>&lt;tilde&gt;</code> are treated as a possible login name from the user database. A portable login name cannot contain characters outside the set given in the description of the LOGNAME environment variable in XBD Other Environment Variables. If the login name is null (that is, the tilde-prefix contains only the tilde), the tilde-prefix is replaced by the value of the variable <code>HOME</code>. If <code>HOME</code> is unset, the results are unspecified. Otherwise, the tilde-prefix shall be replaced by a pathname of the initial working directory associated with the login name obtained using the <code>getpwnam()</code> function as defined in the System Interfaces volume of POSIX.1-2008. If the system does not recognize the login name, the results are undefined.</p> </blockquote> <p>Note in particular that if my username is <code>me</code>, the results of <code>cd ~</code> and <code>cd ~me</code> may not be the same! Specifically, the <code>HOME</code> environment variable could be set to a value different from the one returned by <code>getpwnam()</code>. I've been using this technique for (way over 25) years to set my <code>HOME</code> where I want it, and the few programs that don't recognize the difference between <code>cd ~</code> and <code>cd ~me</code> are some (of the many) banes of my life.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload