Skip to content

cd

builtin · libnexusinterp/corefcn/dirfns-proprietary.cc

: cd dir
: cd
: old = cd (dir)
: cwd = cd ()

Change the working directory to dir.

With an output the previous directory is returned. Without any argument the working directory is not changed: as a statement cd displays the current folder and with an output it returns it. dir may be relative to the current folder and ~ stands for the home directory. An empty dir, a name that does not exist or the name of a file is an error, and the folder is left unchanged. The function is also available as chdir.