Shell自动交互的三种方法


方法一


(echo "password";) | read input_pwd

方法二


read input_pwd << EOF

password

EOF

方法三


#!/usr/bin/expect

spawn ssh root@192.168.0.1

expect "password:"

send "123\n"

interact

Advertisements

3 thoughts on “Shell自动交互的三种方法

  1. I think your website needs some fresh content. Writing manually takes a lot of time, but there is tool for this time consuming task, search for; Ssundee advices unlimited
    content for any blog

    Like

  2. I think your blog needs some fresh content.
    Writing manually takes a lot of time, but there is tool
    for this time consuming task, search for; Ssundee advices
    unlimited content for any blog

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s