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

How to run command line scripts from within Fortran 90

  1. Mar 22, 2016 #1
    Hey!

    I'm currently making a program which is a three body problem. I managed to get working results which I can plot to gnuplot. The question is, how can I write this within the program itself, so it can automatically plot the information to gnuplot if the user wants it to? (I'm being lazy :P)

    I know I have to create a script, which I have done, but I don't know the function in Fortran 90 which will allow me to call it and then run it automatically. I believe there is a function along the lines of get_command_argument (I tried this but it isn't a function) or something similar to that.

    Thank you for the help!
    AlphaBetaGamma96
     
  2. jcsd
  3. Mar 22, 2016 #2

    jedishrfu

    Staff: Mentor

  4. Mar 22, 2016 #3

    Mark44

    Staff: Mentor

  5. Mar 22, 2016 #4

    jim mcnamara

    User Avatar

    Staff: Mentor

    When you do this on UNIX be sure to include a shebang as the very first line first column of your script. This makes the script run with /bin/whatevershell rather than /bin/sh. Which is the default whenever no shell is specified. Example:
    Code (Text):
    #!/bin/bash
    runs the bash shell to execute the script
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: How to run command line scripts from within Fortran 90
Loading...