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?

1 Answer 1


You have to use double-quotes like this :

watch "bash -c 'echo hello'"

Or, the other way around:

watch 'bash -c "echo hello"'
  • But why? Does bash not receive "echo hello" command, but "echo" for example?
    – sevo
    Commented Nov 8, 2015 at 17:33
  • Exactly ! You can add -x to bash to see what it is doing.
    – Vinz
    Commented Nov 8, 2015 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .