Skip to content

Instantly share code, notes, and snippets.

@joekiller
Created October 19, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joekiller/1fd35048f2d7e1122884 to your computer and use it in GitHub Desktop.
Save joekiller/1fd35048f2d7e1122884 to your computer and use it in GitHub Desktop.
Dynamically add project specific files, create an alias to access.
#!/usr/env/bash
secrets=$(whoami)
ROOT_DIRS=$(find . -maxdepth 1 ! -path . -type d ! -path './.*' -print | tr '\n' ' ')
for path in $ROOT_DIRS; do
ALIAS=
[[ -f ${path}/.bashrc ]] && ALIAS=". $HOME/${path}/.bashrc;"
[[ -f ${path}/.${secrets}-secrets ]] && ALIAS="${ALIAS}. $HOME/${path}/.${secrets}-secrets;"
[[ ! -z ${ALIAS} ]] && alias $(basename ${path})="${ALIAS}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment