I'm trying to capture the files that this command types out, but i'm not able to do it. I'm pipeing everything to the telnet command because if i dont the connection closes. Any suggestions.
#!/bin/ksh
hostn='x.x.x.xx xxxx'
(echo "open $hostn\r"
sleep 3
echo " \r"
sleep 2
(echo "dir disk1:\r"; sleep 3 ; echo "\r") | tee > /usr/autoprog/prod/rob/dump2
echo "\r"
sleep 2
grep -i c12kprp-diag-mz.RELEASE66 < /usr/autoprog/prod/rob/dump2
rcode=$?
echo "$rcode"
sleep 2
echo "dir disk1:\r"
sleep 3
grep -i "size"
rcode=$?
echo "$rcode"
sleep 2
) | telnet &
exit
Results:
rommon 83 >
rommon 83 > <=== It's trying to save it to dump2 file here. Right?
rommon 84 >
rommon 84 > 1
monitor: command "1" not found
rommon 85 > dir disk1:
File size Perms File name
15803788 -rw- c12kprp-diag-mz.RELEASE66
25899492 -rw- c12kprp-p-mz.120-32.S.bin
3009536 -rw- c12k-fpd-pkg.120-32.S.pkg
0 drw- LOST.DIR
3009536 -rw- c12k-fpd-pkg.120-32.S1.pkg
3020288 -rw- c12k-fpd-pkg.120-32.S3.pkg
rommon 86 >
rommon 86 > 1
monitor: command "1" not found
rommon 87 > Connection closed by foreign host.
If i dump the results of file dump2. I get:
% more dump2
dir disk1:
<=== Where's the output????
I've tried it without the "tee" and i still just get dir disk1:
Is there a better way of saving a couple of line after "dir disk1:" to maybe a variable to that i can compare it.
Thanks for any help