1

I'm kinda new in bash, the thing is I need to run several set of data in a program, I make a bash script that allow me to do it automatically... the problem is when the program start it needs some inputs and I don't know how to give it inside the bash? I execute the program:

$./bin/mg5_aMC

The program opens and I need to pass some input to run (mg5> is the enviroment of the program):

mg5>launch file.lhe

the program runs, and ask for something:

mg5> 1

and then again, ask for something and i need to press enter..

mg5> (enter)

PD.: I edited the question because I suppose didn't express myself very well..

3 Answers 3

1

From what I understood from your question, you either want 1) to pass parameters when calling your Bash script, or 2) some sort of interactive shell within your script.

For #1, passing parameters to a Bash script, these links may be helpful:

Basically, you need to use the following call for your script:

./bin/mg5_aMC launch xxx.lhe 1

And within your script, you refer to each argument using a numbered variable:

action=$1
file=$2
n=$3

As for #2, consult the following links/examples:

There are quite a few resources online and on this site that will provide you more example and explanations.

Sign up to request clarification or add additional context in comments.

Comments

0

If the program can get its input as arguments passed from the command line, then you can write the parameters in a file, call it e.g. params, then do

./bin/mg5_aMC $(<params)

1 Comment

This will also create other problems: impossible to give arguments with spaces or glob characters…
0

From what I see, you rather want to catch user's input, than simply pass args to executed script. read command allows you to catch user's input. Did it answers your question?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.