Learn R Programming

cgwtools (version 4.1)

popd: Performs equivalent of bash command with same name

Description

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

Usage

popd(dn=FALSE, pull=0)

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.

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.

Author

Carl Witthoft carl@witthoft.com

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 in the function's environment (not console environment).dirhist, typically first created with pushd .

See Also

pushd , setwd

Examples

Run this code
## depends on your local directory structure and permissions
getwd()
pushd("~/..")
getwd()
popd()
getwd()

Run the code above in your browser using DataLab