Skip to content

Instantly share code, notes, and snippets.

@nobiki
Last active March 7, 2019 02:56
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 nobiki/ba7458ed2026fbd7805d655a6f6989a7 to your computer and use it in GitHub Desktop.
Save nobiki/ba7458ed2026fbd7805d655a6f6989a7 to your computer and use it in GitHub Desktop.
面倒な認証とかをexpectで自動化するスクリプト(例: rim git clone https://〜)
#!/bin/bash
ARGS=$@
# match command only
if [ "git" == ${1} ]; then
expect -c "
set timeout 60
spawn ${ARGS}
while (1) {
expect \"Password for\" {
send \"[password here.]\r\"
}
}
"
fi
# grep username and hostname
# if [ "git" == ${1} -a `git config --list | grep "[username here.]@[hostname here.]"` ]; then
# expect -c "
# set timeout 60
#
# spawn ${ARGS}
#
# while (1) {
# expect \"Password for\" {
# send \"[password here.]\r\"
# }
# }
# "
# fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment