Skip to content

Instantly share code, notes, and snippets.

@jamesbloomer
Created July 2, 2012 09:55
Show Gist options
  • Save jamesbloomer/3032391 to your computer and use it in GitHub Desktop.
Save jamesbloomer/3032391 to your computer and use it in GitHub Desktop.
Script to read a file containing pair information, randomly select one and set it as global config
# Expects the pairs file to be in the following format
#
# user1 user1@company.com
# user2 user2@company.com
test "$IGNORE_COMMIT_SWITCH" == "TRUE" && exit 0
readarray input < ~/.pairs_list
number=${#input[*]}
selected=${input[$((RANDOM%number))]}
selected_array=( $selected )
echo "${selected_array[0]}"
echo "${selected_array[1]}"
git config --global user.name "${selected_array[0]}"
git config --global user.email "${selected_array[1]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment