Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Running FORTRAN executable from Linux SHELL

  1. Feb 1, 2013 #1
    I have noticed an issue I must resolve before writing a GUI for my FORTRAN program in Linux.

    If I move into the directory (cmd line) and type ./myprogram it works fine. It reads the input file from that directory and creates an output file.

    If I run it from the file manager it gives me 2 options 'execute' or 'execute from terminal'. Neither one works. I don't see anything happening and a new output file is not created.

    In GAMBAS3 I tried a shell command which gave me a hint. I got an EOF error. So it could not find the input file. It is as if it is running the FORTRAN program in oblivion instead of from the directory using the directory resources. I tried complete path in the shell as well as cd in the shell.

    I also tried compiling the GAMBAS program and moving it into the directory of the FORTRAN program. No Luck.

    What am I missing? (using Debian for Raspberry pi)

  2. jcsd
  3. Feb 2, 2013 #2
    I figured it out. It turns out that no matter where you have the executable, the curdir is always whatever your home directory is. I don't like it but there it is.

    So if I run my program from it's directory (in file manager), the input and output files must be in that home directory.

    Command line works fine always.

    In the case of Gambas, it does not matter where the Gambas executable resides...the home directory is where it looks. Gambas does not even understand the concept of curdir.

    Oh well :)

    Thanks anyway,

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook