I have a Brocade FC switch that I'd like to do some zoning on. I have a build file with too many lines to copy-paste into a normal interactive session, and I have ssh set up with pre-shared keys between the switch and my unix management server. I do not have expect and would prefer to stick to straight ssh and bash.
I've tried sending the commands individually, however it fails because each ssh command is an individual session, and all uncommitted commands are flushed as soon as the session is dropped.
I've tried this:
cat testbuildfile | ssh -tt user@switch
It almost works, in that it runs all the commands in my build file, however it leaves me with a session on the Brocade I can't use when they're finished. I have my Brocade command prompt, but if I enter anything, it hangs and I have to ctrl-c to get back to my unix server.
I know that I can put the commit command into my build file, but I'd rather have a chance to check and validate the work before committing it. Ideally, I'd like to have it run my command file and then leave me logged into the session it started for me to check and then manually commit the commands. Can I do this?
edit: running scripts on the Brocade switches is not possible without an elevated shell that would void the warranty.
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: