Skip to content

Instantly share code, notes, and snippets.

@bltavares
Last active August 29, 2015 14:02
Show Gist options
  • Save bltavares/f4113a77ad93707171f2 to your computer and use it in GitHub Desktop.
Save bltavares/f4113a77ad93707171f2 to your computer and use it in GitHub Desktop.
#!/bin/bash
password_file=$1
update_account() {
USERNAME=$1
PASSWORD=$2
FILE=$3
awk -i inplace "/username: '$USERNAME'/ { print \$0; getline; \$2="'$PASSWORD'" } { print \$0 }" $FILE
}
while read line; do
update_account $(tr ':' ' ' <<<"$line") file/accounts/accounts.rb
done < $password_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment