近来repo sync时经常需要多次输同样的密码:
sudo apt-get install expect
使用如下脚本来实现执行repo sync命令时自动输入口令:
#!/bin/bash
PASS="you psd"
expect -c "
set timeout -1
spawn -noecho repo sync
expect {
"*password:*" { send \"$PASS\r\"; exp_continue }
"*Password:*" { send \"$PASS\r\"; exp_continue }
eof { exit }
}
exit
"