I tried to find solution but I don't know how to do it. I want to start terminal on raspberry pi x times, to run python scripts in paralel.
I tried gnome-terminal
or xterm
but nothing did what I wanted or wrote command not found.
This cmd:
#!/bin/bashint
for word in $(cat inputs.txt); do python3 enttest.py $word; done
This command gets every line from inputs.txt
file and passes it as parameter to a python script which runs for x hours (one line, one parameter).
I need it to start x terminal based on how many lines there is in the inputs.txt
file. I want this automatic because the inputs will be generated/dynamic. The script is very simple and I manually started 12 terminals which worked fine on slow raspberry.
Input file can look like this:
input1
input2
No crazy stuff with the inputs like space or special character. I will have more parameters in future in the input files but those can be separated by delimiter. Thanks.
You can do that without starting new terminals. If you do this:
#!/bin/bashint
for word in $(cat inputs.txt)
do python3 enttest.py "$word" &
done
bash will execute the scripts in parrallel (it will create a new process for each call), due to the single ampersand (&) after the command.
So the program should execute rather quickly, and then the python3 enttest.py
tasks will work in the background.
You can read more on that here : https://bashitout.com/2013/05/18/Ampersands-on-the-command-line.html