Command using linux with multiple calls

How can I combine two (or more) calls with the watch ?
So they run together (sequentially) and does watch show their combined output?

those. watch command1 command2

So, to show the contents of two different directories:

 watch $(ls dir1) $(ls dir2) 

(For clarity, subshell parsers are just added.)

Of course, I could create a script to run both commands, translate the results into a tempfile and periodically review its contents after hours, but I would refrain from it if it was initially possible in some way. :)

Subheadings, grouping, replacing processes did not help me, so I was unlucky and have no idea where to look now.

Is this even possible?

UPDATE:

 watch cat <(ls dir1) <(ls dir2) 

gives me at the first iteration what I would like to update periodically, but not once :(

+5
source share
1 answer

watch by default runs the passed command in the shell, so you can pass it any command that is valid for the shell:

 watch 'ls dir1; ls dir2' 
+12
source

Source: https://habr.com/ru/post/1215586/


All Articles