Created
July 2, 2012 09:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Expects the pairs file to be in the following format | |
# | |
# user1 [email protected] | |
# user2 [email protected] | |
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