Programmatically dereference/resolve aliases in bash
问题 I need to determine which command a shell alias resolves to in bash, programmatically; i.e., I need to write a bash function that will take a name potentially referring to an alias and return the "real" command it ultimately refers to, recursing through chains of aliases where applicable. For example, given the following aliases: alias dir='list -l' alias list='ls' where my function is dereference_alias , dereference_alias list # returns "ls" dereference_alias dir # also returns "ls" Is there