Skip to main content
edited tags
Link
Jeff Schaller
  • 67.7k
  • 35
  • 118
  • 255
Source Link

Define function in fish, use it with watch

I want to define a function, and call that function every n seconds. As an example:

function h
    echo hello
end

Calling h works:

david@f5 ~> h
hello

But when using watch, it doesn't...

watch -n 60 "h"

...and I get:

Every 60.0s: h                                      f5: Wed Oct 10 21:04:15 2018

sh: 1: h: not found

How can I run watch in fish, with the function I've just defined?