Add BOOKMARKing functionality to dirs plugin
parent
9c74671b10
commit
c6e096e35d
|
|
@ -50,3 +50,35 @@ function dirs-help() {
|
|||
echo "8 : Chance to stack location 8."
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue