Shell Sudo With Password On Command
2016-07-03 18:53
344 查看
1.sudo -S <<< '密码' 要执行的命令 2.expect -c 'spawn sudo 要执行的命令;expect password;send "密码\n";interact;'
请注意:
第一行是用单引号括起来的
第二行最外层是用单引号括起来,密码使用双引号括起来的
以上代码 本人亲测可行!
相关文章推荐
- vim编写Bash脚本
- 如何使用shell脚本快速排序和去重文件数据
- shell查询xml内容
- bash 脚本编程 利用 “=” 赋值时,左右不能留空格
- BASH
- bash变量
- linux chsh命令参数及用法详解(linux设置系统shell命令) !!!
- 更改Ubuntu 12.04默认的shell(使用的是 L 类型)
- Linux下安装终极Shell Zsh
- bash、dash与zsh shell
- zsh on windows 10 bash
- 跟我一起写shell补全脚本(Zsh篇)
- py学习之路1-字符串
- windows 10 bash update xenial(16.04)
- shell使用小结
- 嵌入式学习入门
- bash基本特性
- ICDM 2014 Paper ShellMiner Mining Organizational Phrases in Argumentative Texts in Social Media
- linux shell(1)
- Xshell 链接 VMware 里的 Linux