sshlibrary.Execute Command giving command not found error

Hi,

I am executing a command on server using SSHLibrary, when I am executing with Write command it works fine but when I am using Execute Command for the same command, it is throwing bash: command not found. Exit code 127 error.

Write    isql -P password -U user1 -S db_name
${output}    Read    3s

Above code is working fine and I am getting the output but why below code giving command not found error.

${output}    Execute Command   isql -P password -U user1 -S db_name

Why I want to use Execute Command rather than Write is because Execute Command gives only the command’s output whereas Write gives all things which is visible in terminal and after using Write, I need to filter out the content everytime.

Note- My use case is to execute a SQL query on Sybase databse using terminal only, so for that I am using isql.

Please tell me what is wrong with Execute command.
Thanks

Normally it would be much more secure to use full paths in system commands to do things. Like instead of using just isql, usage could be /usr/bin/isql and that way it is always executing same command, and not random command found in PATH. And command does not even have to be in PATH, if full path is used.

And to find out full path, you can use command which isql on that target machine.

1 Like