On Thu, Jun 24, 2021 at 09:48:59AM +0200, Phi Debian wrote:
> $ function echo { \echo the function version; \echo "$@"; }

For the record, this isn't how you write a function that wraps a builtin.
Use the "builtin" command instead.

echo() {
  printf 'echo() wrapper invoked.\n'
  builtin echo "$@"
}

Or, if you aren't sure whether the command you're wrapping is a builtin
or a program, use "command":

echo() {
  printf 'echo() wrapper invoked.\n'
  command echo "$@"
}

The backslash hack only stops aliases from being used.  It doesn't stop
your function from calling itself recursively.

Reply via email to