Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: What makes %# tick?



On Jan 23, 12:28pm, Tim Haynes wrote:
}
} Just noticed an interesting anomaly after starting to use the realtime
} module[0] on linux

The %# prompt changes from % to # any time the effective user ID is zero,
as reported by geteuid().  If your OS supports POSIX capability sets,
it also changes to # when cap_get_flag() indicates that any capability
set returned by cap_get_proc() has the CAP_EFFECTIVE property.  This is
probably what's happening in your case.  It's also quite possible that
the code in zsh that is testing cap_get_flag() is doing it wrong, but
it's been around a long time and no one has griped yet.

The test %(#.#.%%) on the other hand only checks geteuid() for zero, so
as a workaround you can replace %# with %(#.#.%%).  (For reasons I've
forgotten, %# is really the same as %(!.#.%%).)



Messages sorted by: Reverse Date, Date, Thread, Author