Skip to content

Instantly share code, notes, and snippets.

@TaurusOlson
Created April 21, 2011 23:01
Show Gist options
  • Save TaurusOlson/935669 to your computer and use it in GitHub Desktop.
Save TaurusOlson/935669 to your computer and use it in GitHub Desktop.
Bash function to source config files and create aliases
# Usage: init_config CONFIG_FILE
# Description: Source the configuration file, and create an alias to edit it
init_config() {
local CONFIG_FILE=$1
if [[ -r $CONFIG_FILE ]]
then
source $CONFIG_FILE
CONFIG_ALIAS=".$(basename $CONFIG_FILE)"
alias $CONFIG_ALIAS="vi $CONFIG_FILE"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment