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

Re: Could you provide bash's \$ which like zsh %#?



I got the description on 'man zshmisc'

       %#     A  `#'  if  the  shell is running with privileges, a `%' if
not.
              Equivalent to `%(!.#.%%)'.  The definition of `privileged',
 for
              these  purposes,  is  that either the effective user ID is
zero,
              or, if POSIX.1e capabilities are supported, that  at  least
 one
              capability  is  raised  in  either  the Effective or
Inheritable
              capability vectors.

So, to match the document, I should change the prompt to
PS1='%(!.#.$)'

2011/12/7 Jos Backus <jos@xxxxxxxxxxx>

> What do you mean by 'document'?
>
> Jos
> On Dec 6, 2011 9:35 PM, "Daniel Lin" <dlin.tw@xxxxxxxxx> wrote:
>
>> I think it may workable by following setting.
>> But, I don't know how to get its document.
>>
>> zsh --version                                                   ~
>> 13:29:54 (1)
>> zsh 4.3.12 (i686-pc-linux-gnu)
>>
>> PS1='%(#,#,$)'  # simulate bash's \$
>> in normal user, it will display $
>> in super user, it will display #
>>
>> 2011/12/7 Jos Backus <jos@xxxxxxxxxxx>
>>
>>> Fwiw, here's what I am seeing (on FreeBSD -current using zsh 4.3.12):
>>>
>>> lizzy:~% % PS1='%# %(#,$,%%) '
>>> % %
>>> % %
>>> % % sudo -s
>>> lizzy:/home/jos# PS1='%# %(#,$,%%) '
>>> # $
>>> # $
>>>
>>> On Tue, Dec 6, 2011 at 9:03 PM, Daniel Lin <dlin.tw@xxxxxxxxx> wrote:
>>>
>>>> PS1='%# %(#,$,%%)'
>>>
>>>
>>>
>>> --
>>> Jos Backus
>>> jos at catnook.com
>>>
>>
>>


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