Add BOOKMARKing functionality to dirs plugin

pull/75/head
Yakkala Yagnesh Raghava 2011-08-06 00:14:15 +09:00
parent 9c74671b10
commit c6e096e35d
1 changed files with 32 additions and 0 deletions

View File

@ -50,3 +50,35 @@ function dirs-help() {
echo "8 : Chance to stack location 8." echo "8 : Chance to stack location 8."
echo "9 : Chance to stack location 9." echo "9 : Chance to stack location 9."
} }
# ADD BOOKMARKing functionality
# usage:
if [ ! -f ~/.dirs ]; then # if doesn't exist, create it
touch ~/.dirs
else
source ~/.dirs
fi
alias L='cat ~/.dirs'
G () { # goes to distination dir otherwise , stay in the dir
cd ${1:-$(pwd)} ;
}
S () { # SAVE a BOOKMARK
/bin/sed "/$@/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs;
echo "$@"=\"`pwd`\" >> ~/.dirs;
source ~/.dirs ;
}
R () { # remove a BOOKMARK
/bin/sed "/$@/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs;
}
alias U='source ~/.dirs' # Update BOOKMARK stack
# set the bash option so that no '$' is required when using the above facility
shopt -s cdable_vars