title: How delete file from fortran code?
body: <p>I need to delete a file from a <code>Fortran</code> code. I am on <code>ubuntu 12.04, x86_64</code>. I don't understand why the procedure described below does not work. Please help me to clarify the situation (actually, on some systems, it works, but not on mine). </p>
  
  <p>There is another way: I can call directly unix command <code>rm -f file</code>, but I'd like to know what is wrong with my method. Thank you.</p>
  
  <p>Step 1. make simple script del.sh and put it into ~/bin</p>
  
  <pre><code>$ cat del.sh
  [ $# -ge 1 ] &amp;&amp; rm -f $1
  $ chmod u+x del.sh; mv del.sh ~/bin 
  </code></pre>
  
  <p>Step 2. Fortran code, del.for:</p>
  
  <pre><code>character*100 cmd
  character*30 file
  call getarg(1,file)
  write(cmd,100) file
  100   format('source del.sh ',a30)
  call system(cmd)
  end
  </code></pre>
  
  <p>Step 3. Compile and run:</p>
  
  <pre><code>$ ifort -o del del.for
  $ ./del file
  </code></pre>
  
  <p>Results: </p>
  
  <pre><code>sh: 1: source: not found
  </code></pre>
  
  <p>What is wrong? The simple 'source del.sh file' works, but not from Fortran code... that is confusing.</p>
  
  <p>From the Fortran code: </p>
  
  <pre><code>100 format('del.sh ',a30)
  100 format('bash del.sh ',a30)
  </code></pre>
  
  <p>work perfectly, but </p>
  
  <pre><code>100 format('sh del.sh ',a30)
  </code></pre>
  
  <p>does not work. I have <code>bash</code> installed, but no <code>csh</code>. Thank you.</p>