I am trying to automate a scanning proccess for a physical application. My script is
#!/bin/bash i=1 file="ATLASbins.txt" while IFS= read line do scan=$line cat test.sh | sed "s/ set vchi 5000/ set vchi $scan/g" > test2.sh chmod +x test2.sh bash -x /home/mario/Mine/test2.sh i=$((i + 1)) done <"$file"
Where test2.sh is another script in which I launch the application in which the scans are made. An example of what goes in the second script is
#!/bin/bash /home/mario/mg5/bin/mg5_aMC "import model Implementation" "generate u++ > l+ l+" output firstscript$i set vchi 6500 launch firstscript$i
Where 'import model', 'output' and 'launch' are commands of the application (which runs in the terminal).
What happens is that the commands (inside the application) don't work and I get lines like
PATH/test2.sh: line 5: import model Implementation: command not found
I have no idea how to do this (which is to write a script that can write the commands to the application) and have tried various different separators, running the test2 script in a different shell and to call it in a new terminal using terminal-gnome. How can I make this work?
Another observation is that I need the variable value of i to be written inside the application. I tried this writing, for instance, 'output firstscript$i', which wouldn't work even if the command worked, I imagine.
mg5_aMC
program, and you want the rest of that script sent as input to said program? Or something else? Does the first script have anything to do with the issue at hand?set vchi
setting). Is the application, which I presume ismg5_aMC
, expecting input on its standard input or by using its command line arguments when starting it? The$i
in the second script would be empty since it's an unexported shell variable in the first script only.mg5_aMC
from the command line, would it expect the other commands in your second script as input from the keyboard? Would redirecting these command from a text file intomg5_aMC
make the program accept them as commands?