Last active
July 17, 2019 16:41
-
-
Save BoQsc/048ea14bbb1f9555ba058027aa22ff3a to your computer and use it in GitHub Desktop.
Launches Firefox in Headless mode, as background process and waits for output from Firefox. Also saves the PID of the launched Firefox to a variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
killall "firefox"; | |
exec 3< <(firefox --headless 2>&1 & echo $!) # & firefox_pid=$! | |
#echo $firefox_pid &! | |
for i in 1 2 3 4 5; do read <&3 line; | |
if [ $i -eq 1 ]; then firefox_pid="$line" | |
fi | |
if [ "$line" == "*** You are running in headless mode." ]; then echo "here is the line" | |
fi | |
echo "$i $line"; | |
done | |
#tempo=`$(firefox --headless) & `; | |
#wait | |
#echo "here &(<$tempo) here" | |
#firefox_pid=$! | |
# firefox --headless & | |
#firefox_pid=$! | |
# echo $firefox_pid | |
# for i in 1 2 3; do read <&3 line; echo "$line"; done | |
#wait | |
# kill "$firefox_pid" | |
#echo $output | |
#kill "$firefox_pid" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment