Shortcut Command To Watch A File For Changes

October 2022

These are old notes.

I'm using watchexec now

I load this in my dotfiles to provide a watch PATH command that prints out a file to the terminal every time it changes.

function watch () {
    fswatch -event UPDATE -0 "$1" | xargs -0 -n1 cat
}

TODO

    ☐

    Update this so that if no argument is passed in it doesn't try to watch the entire system (or whatever it would do if there's no path)

    ☐

    link to the file that shows how to execute the file when it changes

end of line