This one has been bugging me for a while: I want to use the marvelous GNU watch
command to run a few custom aliases and functions that are defined in my .bashrc, but it is never able to run anything except bash built-ins or binaries.
watch -d foo
The output is always: foo: command not found
How can I make it inherit my environment or use the .bashrc?
Thank you.
Do something like this
watch bash -i -c 'alias -p'
this should call bash, load your settings and then run whatever command you have after the-c
From
man watch
:So it's not going to see your Bash aliases and functions.