0

How can I perform the following operations?

./a.out 1 2 

instead of using:

./a.out

'Enter first value:' (read) 1

'Enter second value:' (read) 2

I wouldn't like to modify the source of my program a.out written in Fortran.

TobiR
  • 207
  • 3
  • 11

1 Answers1

3

Just put a wrapper around your a.out. So, save the following as wrapper:

#!/bin/bash
./a.out<<EOF
$1
$2
EOF

Now make that executable with:

chmod +x wrapper

Then you can run:

./wrapper 3 4
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432