title: gfortran: fatal error: no input files compilation terminated
body: <p>I am starting to program in Fortran with gfortran recently on Mac OS X 10.6.8. I wrote the following simple <code>.f90</code> programs:</p>
  
  <p><code>sayhi.f90</code>:</p>
  
  <pre><code>subroutine sayhi()
    implicit none
    ! Display output to screen
    print*, 'Hello World'
  end subroutine sayhi
  </code></pre>
  
  <p>and <code>main.f90</code>:</p>
  
  <pre><code>program main
    implicit none
    call sayhi()
  end program
  </code></pre>
  
  <p>When I type the following command in Terminal, the program compiles as expected:</p>
  
  <pre><code>gfortran sayhi.f90 main.f90 -o helloworld.out
  </code></pre>
  
  <p>However, when I try to use a bash script <code>helloworld.sh</code>:</p>
  
  <pre><code>#!/bin/bash
  
  # Set your compiler (ifort, gfortran, or g95)
  # Note: no space before equal sign
  F90= gfortran
  
  # Clear old files
  rm *.o
  
  # Compile and link (note: variable is used via a $ sign)
  $F90 sayhi.f90 main.f90 -o helloworld.out
  </code></pre>
  
  <p>and type in Terminal</p>
  
  <pre><code>bash ./helloworld.sh
  </code></pre>
  
  <p>the following error returns:</p>
  
  <pre><code>gfortran: fatal error: no input files
  compilation terminated.
  rm: *.o: No such file or directory
  ./helloworld.sh: line 11: sayhi.f90: command not found
  </code></pre>
  
  <p>I am sure that gfortran is properly installed, since directly inputing the command in Terminal works fine, and all the <code>.f90</code> and <code>.sh</code> files mentioned above are in the same directory, which is my present working directory. Even if I refrain from using the variable <code>F90</code> and use the <code>gfortran</code> command directly in the shell file, the same <code>no input files</code> problem occurs.</p>
  
  <p>Could anyone help me identify what the problem is? Many thanks!</p>