Forum Discussion

Jeremy_Hobbs_18's avatar
Jeremy_Hobbs_18
Icon for Nimbostratus rankNimbostratus
Feb 02, 2015

using putty or plink to access bash and pass multiple commands

Hello All,

 

I hope you can help.

 

I am running 11.4.1 on a 6900.

 

I have a putty script that passes the -m (inputcommandsfile) and currently returns the output for the following commands list ltm virtual show ltm virtual list ltm pool

 

While this works I would like to change the command script to be bash tmsh list ltm virtual tmsh show ltm virtual | grep -B4 Avail tmsh list ltm pool exit quit

 

This would allow me to use the -B4 grep option from the bash utility. However when I try to pass these same types of commands in putty it responds with/usr/bin/tmsh: /usr/bin/tmsh: cannot execute binary file

 

If I login and type those commands manually from putty it works just fine. Any way to pass the command to drop into bash and get this output?

 

Thanks

 

2 Replies

  • Hi Jeremy,

    the user needs so called "advanced shell" privileges. Perhaps you just provided access to "tmsh" and it cannot use the bash.

    Now a command file i.e. as follows can be used:
    tmsh show ltm virtual | grep -B 4 -iE '^[[:blank:]]*availability.*(offline|unknown)'
    

    Thanks, Stephan