Directory Functions

These Korn shell functions implement the C shell directory management commands: dirs, popd, and pushd. They can be put into a separate cshfuncs file and read in with the . command when necessary. Their basic functionality is:

dirs display directory stack
popd remove directory stack entry and cd to it
pushd add directory stack entry and cd to it

The dirs function lists the current directory stack.

With no argument, the popd function removes the top entry (previous working directory) from the directory stack and changes directory to it. If a +n argument is given, then the nth directory stack entry (nth previous working directory) is removed.

With no argument, the pushd function switches the top two entries (current and previous ...

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.