Performs equivalent of bash command with same name

Description

popd is based on the cygwin bash manpages' description of these commands.

Usage

1
popd(dn=FALSE, pull=0)

Arguments

dn

Determines whether a stack "pop" is to be performed. This is the equivalent of the first argument in bash:popd . If dn is FALSE and pull is zero, then set the new directory to the value at the top of the stack. If dn is TRUE then do not change directory, and look to pull for modifying the stack. See details for why the conditions are set this way.

pull

Equivalent of the latter n arguments in bash. Removes the stack entry corresponding to the pull's value ; can be positive or negative. Note that there may be some inconsistency in how this is handled in different implementations of bash.

Details

Recommend reading man bash for full details of the operations. This implementation will not change the working directory if dn is TRUE The directory history is stored in a file .dirhist, typically first created with pushd .

Value

A status value: 0 for success or 1 if there is no stack file (.dirhist). Future upgrades may include other codes for other failure mechanisms, but for now error messages will have to suffice.

Author(s)

Carl Witthoft carl@witthoft.com

See Also

pushd , setwd

Examples

1
2
3
4
5
6
## depends on your local directory structure and permissions
getwd()
pushd("~/..")
getwd()
popd()
getwd()