How can I combine two (or more) calls by the watch
command?
Such that they are run together (serially) and watch
shows their combined output?
I.e. watch command1 command2
So to show the contents of two different directories:
watch $(ls dir1) $(ls dir2)
(The subshell parens were just added for clarity.)
Of course I could create a script to run both commands, pipe the results into a tempfile and cat it for its contents periodically through watch, but I'd refrain from it if this is natively possible somehow. :)
Subshells, grouping, process substitution did not help me, so I am out of luck and have no idea where to look now.
Is this possible at all?
UPDATE:
watch cat <(ls dir1) <(ls dir2)
gives me on the first iteration what I'd love to see refreshed periodically, but not repeatedly. :(
watch
by default runs the passed command in shell so you can pass it any command valid for shell:
watch 'ls dir1; ls dir2'