which "$(echo $0)"
should work no matter the invokation ;p
if full path, it still returns full path, if just "bash" or such it finds it from $PATH, badoom!
That is likely not the case there, and any such file names are unlikely to exist. Just say: which "$0"
$ which "$(echo $0)"
which: illegal option -- b
usage: which [-as] program ...
$ echo $0
-bash
OSX. True story.fish: $(...) is not supported. In fish, please use '(echo)'. which "$(echo $0)" ^
;)