Running FORTRAN executable from Linux SHELL

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 4K views
jelanier
Messages
67
Reaction score
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)
Jim
 
on Phys.org
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,

Jim