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.