I made a script so I can easily execute multiple programs in different terminals by just writing
./script.sh (numberofprogramstype1) (numberofprogramstype2)
The problem is it only executes one of each type, even though I am looping it based on the arguments given. Here is my code:
gcc program1.c -lpthread
for i in {1..$1}
do
gnome-terminal -e ./a.out
done
gcc program2.c -lpthread
for i in {1..$2}
do
gnome-terminal -e ./a.out
done
Why is this happening and how can I solve it?