Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Could you provide bash's \$ which like zsh %#?
- X-seq: zsh-users 16608
- From: Daniel Lin <dlin.tw@xxxxxxxxx>
- To: Jos Backus <jos@xxxxxxxxxxx>
- Subject: Re: Could you provide bash's \$ which like zsh %#?
- Date: Wed, 7 Dec 2011 15:04:54 +0800
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=auUtZ5syoO9usQmHRqoa7zc1spPjtjJY2lp4Q6MrrQA=; b=Qt/ybc50A3RptPsGeDF9HbEZYGf7ON32g9jrXhVlzayH5IjG5irEuB/KdlmLnqdCwg ij645qKahytLabPvB87TVL3E8krmadmaRkxCJLsdr1EkRl3zUWrvxA7MM/PeEQDfo7Mj P4wibEM2UTKcbglV9t1tiBil4VhSbfXZdpnLM=
- In-reply-to: <CAETOPp3+tdbAMmf9T49Hqc1gfZvYqzXgiLRiAZ=aSCkwWsHKKw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20111207044346.GA6356@primenet.com.au> <CAETOPp3aTwGL7AZ_FkU7sjFWugSNzOguLXofO2ggQFfz30hhvw@mail.gmail.com> <CAPg-njyfncx5imW8P1ozAuOGKLZQd3fk3wF8wtUxnegAWpgdYA@mail.gmail.com> <CAETOPp1LjVpwMKzaLkcod_1_bzm6vH424JLmT8Jzz+V=pHFOOA@mail.gmail.com> <CAPg-njwWN=a6XDv047MwXVSYzuX3Ew5u5tprTnRqFeTpnUopcQ@mail.gmail.com> <CAETOPp3+tdbAMmf9T49Hqc1gfZvYqzXgiLRiAZ=aSCkwWsHKKw@mail.gmail.com>
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