Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 157

Unix shell script using Expect shell

$
0
0

Im writing a script to collect micro code levels for adapters on each servers in AIX, using Expect shell.

#!/bin/kshfor hostname in ABCD123 ABCD234 ABCD445doexpect << 'EOS'set hos {$hostname}spawn ssh padmin@$hostnameexpect "Password:"send "ABC1234\n"expect "$"send "oem_setup_env\n"expect "#"send "lsmcode -A | sed -e 's/^/$hos: /'\n"expect "#"send "exit\n"expect "$"send "exit\n"EOSdone

But unfortunately the script fails to run. Can you please help me

Output should be like this

ABCD123 : sys0!system:CL320_040 (t) CL320_040 (p) CL320_040 (t)ABCD123 : ent0!14101103.CN0110ABCD123 : ent1!14101103.CN0110ABCD123 : ent2!14101103.CN0110ABCD123 : ent3!14101103.CN0110ABCD123 : ent4!14108802.DV0210

Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>