Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export WDHIST=( $(pwd) )
- function cd {
- builtin cd $*
- if [ $? -eq 0 ]; then
- WDHIST[${#WDHIST[*]}]=$(pwd)
- fi
- }
- function cdhist {
- local len=${#WDHIST[*]}
- for (( i = 0; i < $len; i++ )); do
- printf " %4d %s\n" $i ${WDHIST[$i]}
- done
- }
- function cd_ {
- if [ $# -ne 1 ]; then
- echo "Usage: cd_ <#> (# from cdhist)"
- return
- fi
- builtin cd ${WDHIST[$1]}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement