Get the App
SLTechnology News&Howtos  ›  Servers  › 

Two uses of expect

Shulou Source: shulou.com Published: 2022-06-03 00:08:00 09月22日 Update

Yum install expect-y

# install expect first

1. Test usage #! / usr/bin/expect# interpretation language, run here to run with. / run, bash run will report an error spawn ssh root@192.168.0.14# starts a new process expect "* password:" # process receives string, matches send "yxy7714707@\ r" # before matching the content in the input "" expect "* #" send "ifconfig > > 123.txt\ r" send "exit\ r" interact2. Call #! / bin/bash ip=$1# in the sh script to pass the parameter user=$2password=$3expect

Tags: Password file script input actual combat other party run public key fingerprint program process no two key keyword content parameter character string number Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi vpn MariaDB Microsoft Huawei