public
Description: bash scripts, aliases, other misc things go here
Homepage: http://opensource.thinkrelevance.com
Clone URL: git://github.com/relevance/etc.git
etc / bash / project_aliases.sh
8bfebc90 » muness 2008-06-25 make instructions easier to... 1 # In ~/.bash_profile define a PROJECT_PARENT_DIRS array and source this script. e.g.
ced38903 » muness 2008-06-29 bug fix in the usage example 2 # PROJECT_PARENT_DIRS[0]="$HOME/src"
3 # PROJECT_PARENT_DIRS[1]="$HOME/work"
8bfebc90 » muness 2008-06-25 make instructions easier to... 4 # source ~/.project_aliases.sh
b9206205 » muness 2008-06-25 added comments with usage i... 5
e51db76e » muness 2008-06-25 refactoring to better name ... 6 if [ -z "${PROJECT_PARENT_DIRS[*]}" ]; then
7 echo "Define a PROJECT_PARENT_DIRS array in ~/.bash_profile"
3356fd3b » muness 2008-06-25 easy auto-aliases to all yo... 8 fi
9
e51db76e » muness 2008-06-25 refactoring to better name ... 10 for PARENT_DIR in ${PROJECT_PARENT_DIRS[@]} ; do
11 if [ -d "$PARENT_DIR" ]; then
3030b304 » muness 2009-04-30 just in case ls is aliases ... 12 for PROJECT_DIR in $(/bin/ls $PARENT_DIR); do
87589dce » relevance 2008-12-19 don't create an alias if a ... 13 if [ ! -z `which $PROJECT_DIR` ]; then
14 continue # don't set alias if there is something already a command on the path with the same name
15 fi
e51db76e » muness 2008-06-25 refactoring to better name ... 16 if [ -d "$PARENT_DIR/$PROJECT_DIR" ]; then
17 alias "$PROJECT_DIR"="cd $PARENT_DIR/$PROJECT_DIR"
18 fi
3356fd3b » muness 2008-06-25 easy auto-aliases to all yo... 19 done
20 fi
21 done