title: "/bin/bash -l" Invalid option
body: <p>Well, I am trying to run serial MPI jobs masked as a one job on our supercomputer. The main submission script basically looks like that:</p>
  
  <pre><code>#!/bin/bash -l
  #PBS -l nodes=4:ppn=8,walltime=24:00:00
  
  cat $PBS_NODEFILE | uniq | tr '\\012' ' ' &gt; tmp-$PBS_JOBID
  read -a NODE &lt; tmp-$PBS_JOBID
  rm tmp-$PBS_JOBID
  
  inode=-1
  ijob=0
  
  for ((K=1;K&lt;=8;K++))
  do
          [ $((ijob++ % 2)) -eq 0 ] &amp;&amp; ((inode++))
          ssh ${NODE[inode]} _somepath_/RUN$K/sub.script &amp;
  done
  wait
  exit 0
  </code></pre>
  
  <p>Each sub.script looks like:</p>
  
  <pre><code>#!/bin/bash -l
  #PBS -l walltime=24:00:00,nodes=1:ppn=4
  
  module load intel
  module load ompi
  export FORT_BUFFERED=1
  
  *run executable* 
  
  wait
  exit 0
  </code></pre>
  
  <p>And sometimes I encounter an error for each sub.script (jobs die immediately):</p>
  
  <pre><code>/bin/bash: -
  : invalid option
  Usage:  /bin/bash [GNU long option] [option] ...
          /bin/bash [GNU long option] [option] script-file ...
  *etc.*
  </code></pre>
  
  <p>The most interesting thing is that it is a random error meaning if I run the same script for the second (or 3rd etc.) time it will run without any problems. Sometimes I'm lucky, sometimes I'm not... Removing -l won't help because in that case modules cannot be loaded and mpirun won't work. Any suggestions how to fix it?</p>
  
  <p>Thanks a lot in advance!</p>