From: Daniel Lin <dlin.tw@gmail.com>
To: Jos Backus <jos@catnook.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Could you provide bash's \$ which like zsh %#?
Date: Wed, 7 Dec 2011 15:04:54 +0800 [thread overview]
Message-ID: <CAPg-njwHDMbr1JT4xUH9degbZJu-41ED-q5DnoJKz5cJv_MY-w@mail.gmail.com> (raw)
In-Reply-To: <CAETOPp3+tdbAMmf9T49Hqc1gfZvYqzXgiLRiAZ=aSCkwWsHKKw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]
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@catnook.com>
> What do you mean by 'document'?
>
> Jos
> On Dec 6, 2011 9:35 PM, "Daniel Lin" <dlin.tw@gmail.com> 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@catnook.com>
>>
>>> 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@gmail.com> wrote:
>>>
>>>> PS1='%# %(#,$,%%)'
>>>
>>>
>>>
>>> --
>>> Jos Backus
>>> jos at catnook.com
>>>
>>
>>
next prev parent reply other threads:[~2011-12-07 7:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 4:43 Fwd: " Geoff Wing
2011-12-07 4:56 ` Jos Backus
2011-12-07 5:03 ` Daniel Lin
2011-12-07 5:09 ` Jos Backus
[not found] ` <CAPg-njwWN=a6XDv047MwXVSYzuX3Ew5u5tprTnRqFeTpnUopcQ@mail.gmail.com>
[not found] ` <CAETOPp3+tdbAMmf9T49Hqc1gfZvYqzXgiLRiAZ=aSCkwWsHKKw@mail.gmail.com>
2011-12-07 7:04 ` Daniel Lin [this message]
2011-12-07 8:16 ` Bart Schaefer
2011-12-07 10:10 ` Daniel Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPg-njwHDMbr1JT4xUH9degbZJu-41ED-q5DnoJKz5cJv_MY-w@mail.gmail.com \
--to=dlin.tw@gmail.com \
--cc=jos@catnook.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).