- 使用
expect
这种方法需要将密码写死在脚本里,我只是在本地调试设备时这样用。针对服务器操作的话,还是配置密钥比较好。
- 安装
expect
#!/usr/bin/expect
spawn adb shell
expect "login:"
send "root\r"
expect "Password:"
send "test\r"
send "cd /mnt/\r"
interact
expect
expect
#!/usr/bin/expect
spawn adb shell
expect "login:"
send "root\r"
expect "Password:"
send "test\r"
send "cd /mnt/\r"
interact