Thursday, October 04, 2007

Manage Removing Directories from a Stack with popd

I thought about adding the popd command verbiage to the last post (pushd), but I do like to keep these HOWTOs pithy. The pushd command was used to push directories onto a stack, so now I'm going to use the popd to remove directories from the stack. Again, I will use the dirs command to display the stack.

# csh
# dirs
/usr/local/popper / /export/home/esoft/xml/XMLDIR /opt/myapps/etc
# pwd
/usr/local/popper

Removes /usr/local/popper directory
# popd
/ /export/home/esoft/xml/XMLDIR /opt/myapps/etc
# dirs
/ /export/home/esoft/xml/XMLDIR /opt/myapps/etc
# pwd
# /

Removes /opt/myapps/etc directory
# popd +2
# / /export/home/esoft/xml/XMLDIR
# dirs
/ /export/home/esoft/xml/XMLDIR
# pwd
/

No comments: