I'm keeping an eye on a process in FreeBSD using a script which outputs the current status of the job.
Using the csh
builtin command repeat
, I'd like to run the script every 2 seconds, so naively I'd like to do something like this:
repeat 100000 ./dumpstatus ; sleep 2
Obviously the semicolon won't work as intended, but I can't find the correct syntax to include it.
I can workaround by invoking a new shell instance under repeat
:
repeat 100000 sh -c 'path/to/script/dumpstatus ; sleep 2'
but that's hardly ideal, and doesn't take a path from the current pwd
either which is annoying :)
I've also tried repeat 10000 ( ./dumpstatus ; sleep 2)
with and without escaping the brackets, that doesn't work either and I'm not completely sure why.
What is the correct way to do this, without invoking sh -c
, so the semicolon gets interpreted as I would wish?
watch ./dumpstatus
– Ipor Sircer Nov 27 '17 at 07:56watch
isn't the same as the Linuxprocps
watch
: watch -- snoop on another tty line, but for what I can find, it should be available ascmdwatch
orgnu-watch
. – ilkkachu Nov 27 '17 at 08:17