Im writing a script to collect micro code levels for adapters on each servers in AIX, using Expect shell.
#!/bin/ksh
for hostname in ABCD123 ABCD234 ABCD445
do
expect << 'EOS'
set hos {$hostname}
spawn ssh padmin@$hostname
expect "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"
EOS
done
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.CN0110
ABCD123 : ent1!14101103.CN0110
ABCD123 : ent2!14101103.CN0110
ABCD123 : ent3!14101103.CN0110
ABCD123 : ent4!14108802.DV0210