-1

I am new to the bash script. I want to carry out the simulation using bash and I want to make it open the fortran program file.

While I am writing this:

#!/bin/bash

echo "****************************"
./box1.f95 < indata1 >screen_output1

It says it does not have an acces to the box1.f95 file. Why is it working like that even though I have this file in the same directory where the bash script is?

5
  • Could you show the error text? – theoden8 Jul 31 '15 at 20:44
  • ./script: line 4: ./box1.f95: No access. – Beginner in fort Jul 31 '15 at 20:45
  • are you sure that box1.f95 is not a source file? – theoden8 Jul 31 '15 at 20:48
  • Yes! I have already realized that I need to execute the source file and conesuctively run it. Thank You! – Beginner in fort Jul 31 '15 at 20:52
  • Isn't Fortran a compiled language? You must compile and run the binary. You can't execute the source file. And don't speak like that, please, it's a volunteers' site. – theoden8 Jul 31 '15 at 20:54
1

You probably have a file permission problem, specifically the execute permission is not set on the file. Try running the following command:

chmod a+x box1.f95

This will give all users privileges to execute the file. Please note that this assumes that the file is actually executable in one way or another! That means that it has to be a binary executable, or be an interpretable file, starting with a line like #!/path/to/interpreter.

If the file is containing fortran source code, you need to compile it to an executable program, or install a program like binfmtf95-interpreter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.