The post repeat command every x seconds shows that watch
is the utility that is useful for the invoking a command at fixed interval repeatedly.
Now, I have very long commands, and have used aliases to group them logically to get a quicker output, like
$ alias c1='grep "checking for" file1.log'
$ alias c2='grep "validated" file1.log'
$ (echo "Checking: "`c1`) && (echo "Validated: "`c2`)
The output of 3rd command is like
Checking: 100
Validated: 80
It is a long running process, I need to check the status of this process, to get the mentioned counts. But invoking the above with watch
gives error
$ watch '(echo "Checking: "
c1
) && (echo "Validated: "c2
)'
c1 command not found
I can put the entire command in there and remove the aliases, but is there any other work-around to get the aliases working with watch
command?
Note: Did quickly go through the man page for watch
, but didn't find any reference to alias
in specific.