5

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?

sevo
  • 1,217
  • 2
  • 10
  • 22

1 Answers1

5

You have to use double-quotes like this :

watch "bash -c 'echo hello'"

Or, the other way around:

watch 'bash -c "echo hello"'
terdon
  • 234,489
  • 66
  • 447
  • 667
Vinz
  • 2,120
  • 12
  • 16