Send interactive zoning commands to Brocade switch
Solution 1:
Right - you've hijacked stdin in the ssh session and it's no longer connected to your terminal. Unless you add quit
into the command stream it'll hang.
Try this magic instead:
#!/bin/bash
host=blch1-sw3
session=$host.$$
CR="$(echo -e '\r')"
screen -d -m -S $session
screen -S $session -p 0 -X zombie kr
screen -S $session -p 0 -X hardstatus alwayslastline
screen -S $session -p 0 -X hardstatus string "$host config change 3.14159"
screen -S $session -p 0 -X stuff "exec ssh -l USERID $host$CR"
sleep 2
screen -S $session -p 0 -X stuff "PASSW0RD$CR"
sleep 5
screen -S $session -p 0 -X stuff "version$CR"
sleep 2
screen -S $session -p 0 -X stuff "# Changes complete - commit or abort$CR"
screen -x $session