Created
May 27, 2015 04:10
-
-
Save alexanderlperez/85beb769d07147dab1f4 to your computer and use it in GitHub Desktop.
dir bookmarks re: bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#simple bookmarking | |
function bookmarklist { | |
i=0 | |
while ((i++)); read -r line; do | |
echo "$i: $line" | |
done < /tmp/bookmarks | |
} | |
function bookmarkopen() { | |
line=$(sed -n "$1p" < /tmp/bookmarks) | |
cd $line | |
} | |
function bookmarkpop() { | |
line=$(sed -n "$1p" < /tmp/bookmarks) | |
sed -i "" "$1d" /tmp/bookmarks | |
cd $line | |
} | |
function bookmarkdelete() { | |
sed -i "" "$1d" /tmp/bookmarks | |
} | |
# bookmark-related | |
alias ba="pwd >> /tmp/bookmarks" | |
alias bl="bookmarklist" | |
alias bo="bookmarkopen" | |
alias bp="bookmarkpop" | |
alias bd="bookmarkdelete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment