title: How to write shell script,to automate file conversion?
body: <p>I have 30 files(ascii),which I want convert to binary.Linux command line(FORTRAN 77 CODE) that has been compiled</p>
  
  <pre><code>./rec_binary 
  </code></pre>
  
  <p>Relevant part of the code</p>
  
  <pre><code>      character*72 ifname,ofname
  c
        write(*, fmt="(/'Enter input file name')")
        read(5,85) ifname
  85    format(a72)
        write(*, fmt="(/'Enter output file name')")
        read(5,85) ofname
  </code></pre>
  
  <p>Then code asks for input and output file names</p>
  
  <pre><code>Enter input file name
  rec01.txt
  
  Enter output file name
  rec.01
  </code></pre>
  
  <p>How to automate this?I have tried like this</p>
  
  <pre><code>#!/bin/csh -f
  set list = 'ls rec*.txt'
  foreach file ($list)
  rec_binary ${file} &gt; 
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>#!/bin/sh
  for f in .txt
  do
  ./rec_binary F
  done
  </code></pre>
  
  <p>But I do not have a clue for next step.Text files are</p>
  
  <pre><code>rec01.txt
  rec02.txt
  
  rec30.txt
  </code></pre>
  
  <p>Output files</p>
  
  <pre><code>rec.01
  rec.02
  
  rec.30
  </code></pre>