I wish to perform a command ever 10 seconds, and have it executed in the background (thereby eliminating watch?).  All the answers show something like the following, but this will execute ever 11 to 14 seconds.  How can this be accomplished?while true; do    # perform command that takes between 1 and 4 seconds    sleep 10done
Perform command every X seconds
bash;shell;shell script;sleep;watch
How about:( # In a subshell, for isolation, protecting $!  while true; do    perform-command & # in the background    sleep 10 ;    ### If you want to wait for a perform-command    ### that happens to run for more than ten seconds,    ### uncomment the following line:    # wait $! ;    ### If you prefer to kill a perform-command    ### that happens to run for more than ten seconds,    ### uncomment the following line instead:    # kill $! ;    ### (If you prefer to ignore it, uncomment neither.)  done)ETA: With all those comments, alternatives, and the subshell for extra protection, that looks a whole lot more complicated than it started.  So, for comparison, here's what it looked like before I started worrying about wait or kill, with their $! and need for isolation:while true; do perform-command & sleep 10 ; doneThe rest is really just for when you need it.