title: SSHLibrary - A shell script with arguments exits with code 127 and error 'java: command not found'
body: <p>Using Robotframework automation with ssh library, i am trying to execute a shell script with one argument (-a), on a remote UNIX box</p>
  
  <p>The test steps are as follows:</p>
  
  <ol>
  <li>Login to the UNIX box</li>
  <li>Go to the directory where the shell script with argument (-a) is present</li>
  <li>Execute the shell script</li>
  </ol>
  
  <p>Please note:</p>
  
  <ol>
  <li><p>Since 'SSHLibrary' keywords like 'Execute command' or 'Write' and 'Read' work in a single shell, i am passing multiple commands separated by a semicolon</p></li>
  <li><p>In the series of commands, i also tried turning ON the shell using command <code>shopt login_shell</code> but this too did not work. Also note that the command <code>shopt login_shell</code> is not turning ON the shell when executed with 'Execute command' keyword. It works fine with 'Write' keyword</p></li>
  <li><p>The following command to check if JAVA is loaded in the automation shell, returns a correct output (path to JAVA).</p>
  
  <p>Write   $JAVA_HOME
  ${Op_java}= Read</p>
  
  <ul>
  <li>Problem:</li>
  </ul></li>
  </ol>
  
  <p>Following robotframework test step after logging in to the UNIX box fails with exit code 127 and error 'java: command not found'</p>
  
  <p><strong>Method 1 that I tried:</strong></p>
  
  <pre><code>Write   shopt login_shell
  ${Op_Shopt}=    Read
  ${Op_rc}    ${Op_err}=  Execute Command cd /home/xyz/abc; ./shell_script.sh -a  return_stderr=True
  </code></pre>
  
  <p>Here the login_shell is turned ON but somewhere within the shell script the Execute Command keyword exits with code 127 and error 'java: command not found'</p>
  
  <p><strong>Method 2 that I tried:</strong></p>
  
  <pre><code>Write   shopt login_shell; cd /home/xyz/abc; ./shell_script.sh -a
  ${Op_shell}=    Read
  </code></pre>
  
  <p>Here the login_shell is NOT turned ON and even here too the Execute Command keyword exits with code 127 and error 'java: command not found'.
  As mentioned below, i also tried the same approach with the keyword 'Start Command', but still the same issue.</p>
  
  <pre><code>Start Command   shopt login_shell; cd /home/xyz/abc; ./shell_script.sh -a
  ${Op_rc}    ${Op_err}=  Read Command Output return_stderr=True
  </code></pre>
  
  <p>Can someone please help me to resolve this problem?</p>