I think you already know this, but for the record, the answer is: you need cooperation using code that implements an alias.
alternate_name () {
MY_ALIAS_WAS=alternate_name real_name "$@"
}
or, if you really want to use the replaced alias syntax:
alias alternate_name="MY_ALIAS_WAS=alternate_name real_name"
... and then...
$ cat ~/bin/real_name
#!/bin/sh
echo $0, I was $MY_ALIAS_WAS, "$@"
source
share