Just made my first bash script. It spawns a http-server
process in parallel for each folder in a certain directory.
Here is what I have:
PORT=8001
cd websitesfolder
for d in */ ; do
http-server $d -p $PORT &
let "PORT++"
done
This does spawn the http-server
s, but when I exit with Ctrl C, the processes are not killed.
I implemented this without a loop first, and adding && fg
I was able to kill the processes using Ctrl+C
http-server dir1 -p 8001 & http-server dir2 -p 8002 && fg
Is something similar possible with my looped solution?
edit: system is macOS