title: SQL script not executing in bash
body: <p>I am running an SQL script from bash. One of the scripts seems to be running fine, but the other script fails. Can you please advise what might be the cause for the same?</p>
  
  <pre><code>#!/bin/bash
  sqlplus -S user/password@database &lt;&lt; EOF
  whenever sqlerror exit sql.sqlcode;
  set echo off 
  set heading off
  @MyScript1
  @MyScript2
  exit;
  EOF
  </code></pre>
  
  <p>Error:
  <code>SP2-0310: unable to open file "MyScript2.sql"</code></p>
  
  <p>In Unix the access level for both is:</p>
  
  <pre><code> -rwxrwxrwx  MyScript1.sql
   -rwxrwxrwx  MyScript2.sql
  </code></pre>
  
  <p>The error does give an indication that it is not able to access the file <code>MyScript2.sql</code>. But what I am curious about is how come it can access <code>MyScript1.sql</code> which is present in the same folder, but not <code>MyScript2.sql</code>?</p>
  
  <p>Also if I run the file just in unix (using SQL*Plus) from the folder where the files are present it works fine. But if I run the same from a different folder it doesn't. Below example will explain it better </p>
  
  <p><code>/Folder/having/the/files</code></p>
  
  <p>both  <code>MyScript1.sql</code> and <code>MyScript2.sql</code>  run fine </p>
  
  <p><code>/Some/random/folder</code></p>
  
  <p><code>MyScript1.sql</code> runs fine , but <code>MyScript2.sql</code> errors out</p>