 <p>I suspect that inside the script, your working directory is elsewhere, thus you cannot cd. Try this: instead of</p> <pre><code>cd "$DIREC" </code></pre> <p>replace it with</p> <pre><code>echo current directory is $PWD cd "m25.1240_m22.1250_m5.1540" </code></pre> <p>and see if you still have the same problem.</p>