shell
mackentancap
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
用于shell脚本无交互的ssh自动登陆(转载)
ssh连接远程主机时候询问密码,跟su、sudo命令的默认行为一样,是不从stdin读入数据的,据称是为安全考虑,但是有时候在脚本当中确实需要无人守值的登陆。 搜索一下不难找到类似的例子,使用expect来完成密码应答: #!/bin/bash auto_login_ssh () { expect -c "set timeout -1; ...原创 2012-03-27 15:46:54 · 314 阅读 · 0 评论 -
Shell技巧(一)
1.Shell中按颜色输出提示,比如绿色表示成功,红色表示失败,黄色表示警告 NORMAL=$(tput sgr0) GREEN=$(tput setaf 2; tput bold) YELLOW=$(tput setaf 3) RED=$(tput setaf 1) function red() { echo -e "$RED$*$NORMAL" } func...原创 2013-08-15 10:31:08 · 290 阅读 · 0 评论 -
shell脚本-自动打通服务器ssh
使用了expect来处理交互内容,代码如下 #!/bin/sh function usage() { cat << EOF Usage ssh_connect ip [username] [password] EOF } auto_login_ssh() { expect -c "set timeout -1; ...原创 2013-09-18 12:17:30 · 310 阅读 · 0 评论
分享