Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
bronson
12y ago
0 comments
Save
Share
'cd -' is implemented by the cd command using the OLDPWD environment variable. It works in all shells.
0 comments
3 comments · 2 top-level
top
newest
oldest
ggreer
12y ago
· 1 in thread
I did some digging and it turns out I had autopushd set. No wonder I didn't understand the usefulness of pushd/popd; I was already using them.
Also, by "cd -" I meant cd -[tab], cd -1, cd -2, etc.
mokkol
12y ago
Thanks! didnt know the tab feature.
zwegner
12y ago
cd is a shell built-in, not an external command. It has to be, since it changes the directory of the shell process, which can't be done by a child process. So shells do have to implement this specially.
j
/
k
navigate · click thread line to collapse