Re: ssh cmd vs ssh shell (1058 Views)
Occasional Contributor
Posts: 9
Registered: ‎06-06-2010
Message 1 of 4 (1,084 Views)
Accepted Solution

ssh cmd vs ssh shell

[ Edited ]



Two questions around usage of  SSH Command and SSH Shell

(Library -> Operations -> Remote Command Execution -> SSH)


1. SSH Command vs SSH Shell


Command "" runs using putty and produces an xml response.

- when using SSH Command (providing inputs for host, username, password, command =

- command does not execute, operation fails with "command not found"

- running "ls -l", "pwd" using this same step works well


- when using SSH Login, followed by SSH SSH shell, this same "" runs ok.


Question: anyone can explain why the different behavior?


2. SSH Shell does not capture the command response

The commands in my SSH Shell command field:


     expect (.*\s*)*?

The command runs but the output is not captured by OO operation

(I need the response in order to process further)


Question: how to capture ssh shell command output? Seems like what I did above is wrong.


Thanks for your help

BSA presales, Singapore


Trusted Contributor
Posts: 91
Registered: ‎09-18-2011
Message 2 of 4 (1,076 Views)

Re: ssh cmd vs ssh shell



First of all I am not sure which version of OO you are using but I assume that you are using 9.02 or higher.

Secondly whats the version of your RAS machine? I assume its a Unix machine.


When you use SSH Command be sure that you gave the full path of the script file. And be sure the user that you login with has the executable right(chmod 7xx) for the script file. 

I think the script file is in another folder so when you run with "SSH Command" operation you get the "command not found" error.

Try this command  " cd ../foldername_that_script_file_exist ; ./ " in the SSH Command operation.



"SSH Shell" operation captures the responses successfully. There might be something wrong in your command lines.

Here is my command example:


send . ~/.profile ; cd /folder1/folder2/subfolder
expect (.*\s*)*/folder1/folder2/subfolder>
send grep "/${command_text}" ${command_list_file}
expect (.*\s*)*/folder1/folder2/subfolder>


First I am setting my profile settings and getting into a folder with cd command. "cd /folder1/folder2/subfolder" (First Row)

For waiting the prompt line expects my new command I am expecting the "/folder1/folder2/subfolder>" string on the screen. (Second Row)

WithThird Row I am sending a new command (grep) with my parameters.

And at last I am waiting for the command ends and to see the result(Fourth Row). It is expecting the "/folder1/folder2/subfolder>" string on the prompt line again.

After the commands end, you can get the output results in the operation.


I hope it gives a hint and sparks your mind. :)

Best Regards.


Occasional Contributor
Posts: 9
Registered: ‎06-06-2010
Message 3 of 4 (1,070 Views)

Re: ssh cmd vs ssh shell

Thanks for your help.


More info:

- OO 9.02 with CP6

- on Windows 2003 (Windows RAS)


Does this mean I need to use a different ssh shell operation (SSH (Windows RAS)?



Your examples is very good.  Is there a place or doc I can find more examples?




Trusted Contributor
Posts: 91
Registered: ‎09-18-2011
Message 4 of 4 (1,058 Views)

Re: ssh cmd vs ssh shell



Even if you have a windows RAS , there is no need to be use different operation. The main point is the host machine's SSH port is working properly. 


Actually I don't know if there is any document that explains these details. I am only reading the operation's descriptions. If I do not understand properly I check the Authors Guide and the SDK Guide to find some clues about operations. 




The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.