Any remarks for doing bash script more tread save ?
by Lennard37 from LinuxQuestions.org on (#5CZ03)
The follow bash script mark adressbar from firefox, copy the url, echo the url, extract the domain name and echo the domain name.
The script working some rounds and after some time like 10 minutes or 5 hours, xdotool send by self, additional and without to stop by self, additional to the running script, by self by script used keys.
bash script:
Quote:
Error": the keyboard keys which send by script after some times by self, sometimes without to stopp to send:
Quote:
Any idea how what can be do better and more threadsafe ?


The script working some rounds and after some time like 10 minutes or 5 hours, xdotool send by self, additional and without to stop by self, additional to the running script, by self by script used keys.
bash script:
Quote:
#!/bin/bash while true; do # mark the adressbar from browser and copy the url xdotool sleep 0.12 search --onlyvisible --classname Navigator windowactivate --sync key --clearmodifiers --delay 12 F6 Ctrl+c F6 Escape; echo sleep 1 echo echo # copy url from clipboard to var clipboard_url=$( xsel -ob ) echo URL":" "$clipboard_url" sleep 1 echo echo # clear clipboard xsel -bc && xsel -c sleep 1 echo echo # extract domain from url url=$clipboard_url domain=$(echo $url | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/') echo Domain":" $domain sleep 1 echo echo done |
Error": the keyboard keys which send by script after some times by self, sometimes without to stopp to send:
Quote:
Ctrl, like with missing keyup F6 Ctrl+c Ctrl+l |
Any idea how what can be do better and more threadsafe ?