Last active
October 4, 2017 15:31
-
-
Save emhaye/a2e5af125fc5302c21921bf846e65e74 to your computer and use it in GitHub Desktop.
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
| Expect auto task enter password | |
| example: my password `bojong dev` | |
| ``` | |
| #!/usr/bin/expect -f | |
| set force_conservative 0 ;# set to 1 to force conservative mode even if | |
| ;# script wasn’t run conservatively originally | |
| if {$force_conservative} { | |
| set send_slow {1 .1} | |
| proc send {ignore arg} { | |
| sleep .1 | |
| exp_send -s -- $arg | |
| } | |
| } | |
| set timeout -1 | |
| spawn sudo apt update | |
| expect -exact ": " | |
| send -- "bojong dev\r" | |
| expect eof | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment