Watch not showing subshell output

streamswatch

Why does the following not output "hello" line?

watch bash -c 'echo hello'

As this one?

watch 'echo hello'

I expected to have echo write to bash output directly and this to be read by watch and formatted to terminal. Does bash -c not use stdout?

Best Answer

You have to use double-quotes like this :

watch "bash -c 'echo hello'"

Or, the other way around:

watch 'bash -c "echo hello"'
Related Question