In my .profile (sourced in sh emulation mode from my .zshrc) I have the following snippet:
if [ -f /usr/bin/pacmatic ]; then alias pacman=pacmatic fi # Colorized Pacman output alias pacman="pacman --color auto" However, the second alias always overrides the first:
% type pacman pacman is an alias for pacman --color auto How can I make it so that the second alias assignment "inherits" the first assignment, so that if /usr/bin/pacmatic exists, the alias becomes pacmatic --color auto?
I'm not averse to using functions instead of aliases, but I'd prefer it if the logic wasn't performed every time pacman is invoked (I want pacmatic checked for once, at shell startup, not every time pacman is run). I'd also prefer an sh-portable script, but if this isn't possible, you can use full zsh syntax.
(Yes, I'm aware that this could easily be solved by appending --color auto to the pacmatic alias. But I want to do it the Right Way™.)
I've tried Googling and looking through the manpages, but to no avail.
bash), and they can easily call each other.