LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash as input to Fortran (https://www.linuxquestions.org/questions/linux-newbie-8/bash-as-input-to-fortran-766296/)

Natski 11-02-2009 02:06 PM

Bash as input to Fortran
 
Hi guys,

I have an Fortran 90 program which has two values it needs to read in from the shell.

If there was only one read, then I have found that the following script is possible in bash to automate running this f90 code many times...

input=10
echo $input | ./f90program

However, if I have two variables to feed into the f90program, I have found that trying...

echo "$input1 $input2" | ./f90program

...does not work, can anyone suggest a way to solve this minor problem?

Thanks,

Natski

cantab 11-02-2009 02:33 PM

Perhaps don't quote the input variables?

Or maybe your fortran code wants the two variables on seperate lines? In which case

echo -e "$input1\n$input2" | ./f90program

will work

Natski 11-02-2009 02:39 PM

That's perfect, thanks a lot Cantab!


All times are GMT -5. The time now is 10:08 AM.