SSH Shell Operation - how should I define the command?

Hi everybody,

I am dealing with "SSH Shell" Operation trying to figure out how could I use it in a flow for my purposes...

I am not sure I understood how the "command" input should be specified.

From the description of the operation I read:

command - The commands to execute. This should be made up of 'send <command>' and 'expect <regular expression>' statements separated by newlines.

But from a flow of example (available within the installation) SSH Shell Session Sharing Example I am not able to understand how the "expect" part of the command are used.

For example, I see that in the example flow, the first occurence of the SSH Shell step has the following command (in 3 lines):

expect (.*\s*)*?
send export HPOO=yes
expect (.*\s*) [\$#]$


Why does it start with an expect??

and what should be supposed to match the 1st regex (.*\s*)*? ... ??


Any help would be appreciated.

Thank you in advance




  • expect (.*\s*)*?   Will match anything.  Any character, any whitespace, 0 or more occurances.


    The next expect will do the same thing, but expect the end of the line to have either a "$" or "#"



  • Hi,


    Let me try to explain over an example :

    I want to run "cd somefolder" command and after that, I want to run "ls" command. For third execution "ps" command.

    [root@system]/root> cd /Central-9.00


    [root@system]Central-9.00>ls -ltr



    [root@system]Central-9.00>ps -ef


    In OO I have to send commands as below:

    send cd /Central-9.00
    expect (.*\s*)*/Central-9.00>
    send ls -ltr
    expect (.*\s*)*/Central-9.00>
    send ps -ef


    For multi command executions you have to send one command and then wait for system to execute your command. If you don't use "expect" OO can't  understand  when to send following command. "expect" is being used for this. In the example we are telling the system send the commands when we see the bash prompt.


    I hope it will be helpful.




  • In addition expect (.*\s*)*? is regular expression. It uses regular expression for finding the search string.
    In our prompt line it writes $ or # , so we replace "?" with our prompt line character. expect (.*\s*)*#
    After the command execution it searches in the output if it # occurs then sends the following command.
Reply Children
No Data