LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-02-2009, 02:06 PM   #1
Natski
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: 0
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
 
Old 11-02-2009, 02:33 PM   #2
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: Kubuntu, Ubuntu, Debian, Proxmox.
Posts: 553

Rep: Reputation: 115Reputation: 115
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
 
Old 11-02-2009, 02:39 PM   #3
Natski
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
That's perfect, thanks a lot Cantab!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
User input into Bash scripts and checking validity of user input?? helptonewbie Programming 8 07-07-2008 06:40 PM
bash + fortran into .exe would this work TheBrick Programming 10 10-03-2006 06:35 PM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 03:00 PM
Need help defining Fortran 77 input/output streams using g77! Gethyn Programming 1 08-14-2003 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration