Having an alias and a function with the same name leads to some sort of
From:
Yuri Kanivetsky
Subject:
Having an alias and a function with the same name leads to some sort of recursion
Date:
Mon, 2 Jan 2023 10:13:28 +0200
Hi,
#!/usr/bin/env bash
set -eu
alias cmd=echo
cmd() {
echo "$@"
}
set -x
cmd a b c
$ ./a.sh
+ echo a b c
+ echo a b c
...
+ echo a b c
+ echo a b c
Command terminated
Sounds like a bug. I'd expect it to notice the alias, turn "cmd a b c"
into "echo a b c" and print the letters.
Regards,
Yuri