Hacker News new | ask | show | jobs
by Rokid 1691 days ago
Also, in which shell does `cd $` change into a newly created directory?
1 comments

it's `cd $_` with the underscore, it repeat the last argument.

from bash man page

> _ At shell startup, set to the pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subse‐

> quently, expands to the last argument to the previous simple command executed in the foreground, after expansion. Also set to the full pathname used

> to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the

> mail file currently being checked.