[cs631apue] How does cd ~ be translated to cd /home/username?

Jan Schaumann jschauma at stevens.edu
Mon Dec 14 08:53:38 EST 2015


Yanqiao Zhan <yzhan14 at stevens.edu> wrote:
 
> When "cd ~" is executed, how does shell translate this "~" to username?

Your shell does not need to support ~ expansion.  (The reason is that
it's a little more complicated than replacing '~' based on environment
variables or from getpwnam(3).  See any other shell's manual page for
how they handle this.)

-Jan


More information about the cs631apue mailing list