I want to create a bash script that read a URL from a file, open it in a browser, wait a specific time and then close it and repeat the process. Here is the code that I have written but it only open the first URL and stop there
#!/bin/bash
while read p; do
firefox "$p";
sleep 3;
wmctrl -c firefox;
done <TLS
If you want to open all the those links you need to send the firefox process to the background. This is done via the "&" simbol
So for you it would be
firefox "$p" &
EDIT: short explanation why your code isn't working:
Bash executes the firefox commands and waits until it ends (which would be by closing it) and then it continues with the sleep command. But if you know send it to the background bash immediately executes the sleep command and doesn't wait for the firefox command to be finished.