Return to Snippet

Revision: 24682
at March 8, 2010 14:49 by zachharkey


Initial Code
# The following aliases (save & show) are for saving frequently used directories
# You can save a directory using an abbreviation of your choosing. Eg. save ms
# You can subsequently move to one of the saved directories by using cd with
# the abbreviation you choose:
#   % cd ms  
# (Note that no '$' is necessary with 'cd'.)
#
# You can also use in other operations:
#   % cp file1 file2 file3 $acme
# (Here the $ is necessary since (unlike 'cd') the 'cp' command does not
# automatically look for shell variables.)
# 
# See: http://www.macosxhints.com/article.php?story=20020716005123797
# See: http://blog.infinitered.com/entries/show/4

if [ ! -f ~/.dirs ]; then  # if doesn't exist, create it
  touch ~/.dirs
fi
alias show='cat ~/.dirs'
save (){
  command sed "/!$/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ; 
}
source ~/.dirs  # Initialization for the above 'save' facility: source the .sdirs file
shopt -s cdable_vars # set the bash option so that no '$' is required when using the above facility

Initial URL


Initial Description
Creates aliases 'save' & 'show'  for the subsequent creation of on-the-fly aliases to frequently used directories.

You can save a directory using an abbreviation of your choosing. Eg. 'save foo'

<http://www.macosxhints.com/article.php?story=20020716005123797>
<http://blog.infinitered.com/entries/show/4>

Initial Title
Custom .profile / .bashrc config

Initial Tags


Initial Language
Bash