The problem is that when watch is executed it runs sh and I get this error:sh: 1: func1: not foundhere is the code:#!/bin/bashfunc1(){  echo $1}export -f func1watch func1
How to force watch to run under bash
bash;shell;shell script;function;watch
Ok, so there are a few issues with your approach.You are exporting a function, which is not portable between shells. watch executes its commands with /bin/sh, which on your system is not bash. And whatever shell it is, it doesn't respect function exports, so you get the error.Secondly, you can change your command to something like watch bash -c 'func1', but this may not work well either.The reason here being that any variables set by the script won't be available to the function. You might be able to export the ones it needs, but that starts getting messy.The safest solution is to put func1 in a script by itself and call that script. In short, try:watch bash -c func1