Running FORTRAN executable from Linux SHELL

In summary, the speaker has encountered an issue while trying to run a FORTRAN program from the file manager in Linux. They tried using a shell command in GAMBAS3 and compiling the program, but neither worked. After some troubleshooting, they discovered that the program always runs from the home directory, regardless of where the executable is located. This issue also applies when using GAMBAS, as it does not recognize the current directory.
  • #1
jelanier
67
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
 
Technology news on Phys.org
  • #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,

Jim
 

Related to Running FORTRAN executable from Linux SHELL

What is FORTRAN and why is it used?

FORTRAN (short for FORmula TRANslation) is a high-level programming language used for scientific and engineering applications. It is particularly well-suited for mathematical computations and data processing, making it a popular choice for researchers and scientists.

How do I run a FORTRAN executable from the Linux SHELL?

To run a FORTRAN executable from the Linux SHELL, you will first need to compile your program using a FORTRAN compiler such as gfortran. Once your program is compiled, you can use the command "./executable_name" to run it from the SHELL.

Can I use command line arguments when running a FORTRAN executable from the Linux SHELL?

Yes, you can use command line arguments when running a FORTRAN executable from the Linux SHELL. Simply include the arguments after the executable name in the command. For example, "./executable_name argument1 argument2".

What are the advantages of running a FORTRAN executable from the Linux SHELL?

Running a FORTRAN executable from the Linux SHELL allows for quick and easy execution of programs without the need for a graphical user interface. It also allows for the use of command line arguments, making it more versatile and customizable.

Are there any limitations to running a FORTRAN executable from the Linux SHELL?

There are no major limitations to running a FORTRAN executable from the Linux SHELL. However, it may not be the most user-friendly option for those who are not familiar with command line interfaces. Additionally, some advanced features may not be available when running from the SHELL.

Similar threads

  • Programming and Computer Science
Replies
1
Views
623
  • Programming and Computer Science
Replies
10
Views
1K
  • Programming and Computer Science
Replies
25
Views
480
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
1
Views
3K
Replies
19
Views
1K
  • Programming and Computer Science
Replies
34
Views
4K
  • Programming and Computer Science
Replies
22
Views
951
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
12
Views
9K
Back
Top