When you execute a command, your shell forks into a parent process (your
shell) and a child process. The child process then executes the
command.
The child process could, in theory, change its directory – but it
can’t
change the directory of the parent process:
$ pwd
/tmp
$ /usr/bin/cd /
$ pwd
/tmp
I have no idea why that command exists.
(I also have no idea why they use the ${1+“$@”} idiom, since it’s been
irrelevant on virtually everything for years, and certainly never made
any difference on any FreeBSD or Mac OS X shell.)
-s
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.