Macports does what I want (?) not what I say

Rainer Müller raimue at
Thu Jul 4 07:01:37 PDT 2013

On 2013-07-04 14:44, Aljaž Srebrnič wrote:
> The answer as to why are your command line options ignored by
> MacPorts is quite simple. I suppose (and here I'm gonna guess) you
> didn't really do a "port upgrade percona-toolkit" but rather a "sudo
> port upgrade percona-toolkit". The thing is, sudo ignores all your
> aliases! but since you "shadowed" a command (port) with an alias
> (alias port="port -cn") sudo didn't complain and happily executed the
> port command (with no options!).

This is a correct description of the situation. Although this is not
helping in the initial discussion, I want to share an unobvious feature
of bash with you that helps in situations like this. Quoting the man page:

  If the last character of the alias value is a blank, then the next
  command word following the alias is also checked for alias expansion.

Therefore, add the following to your .bashrc:

  alias sudo='sudo '

The space at the end tells bash to look up aliases for the next word.
This means that typing "sudo foo" will lead to 'foo' being looked up as
a shell alias.


More information about the macports-users mailing list