Last active
April 11, 2016 17:51
-
-
Save eyal-rounds/5e7398d33514a71ef322 to your computer and use it in GitHub Desktop.
shell script that accept the license of android sdk update --no-ui
This file contains 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
#!/usr/bin/expect -f | |
# Usage example: | |
# ./accept-licenses "android update sdk --no-ui --all --filter build-tools" "android-sdk-license-bcbbd656|intel-android-sysimage-license-1ea702d1" | |
set timeout 1800 | |
set cmd [lindex $argv 0] | |
set licenses [lindex $argv 1] | |
spawn {*}$cmd | |
expect { | |
-regexp "Do you accept the license '($licenses)'.*" { | |
exp_send "y\r" | |
exp_continue | |
} | |
"Do you accept the license '*-license-*'*" { | |
exp_send "n\r" | |
exp_continue | |
} | |
eof | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment