| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:reply-to:message-id:to:subject | |
| :in-reply-to:references:mime-version:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=D2GfMxZ7GfJIfKDh | |
| kl2snjkBn0dwzI34TTG2dl1STWS0A3XofKpdl1+Y3KFiycpl5+p5GS33AOGrbETQ | |
| +ANCpGgGnk+IR4guehmyMG/vIj4Rj8AjZgs25GecKrWMHMsmfmQq6JYNtAYUdqMe | |
| da+j0328bQODDJchjnk22cZZ/5w= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:reply-to:message-id:to:subject | |
| :in-reply-to:references:mime-version:content-type | |
| :content-transfer-encoding; s=default; bh=+pEFB9QcqySI3H6Bvnoip6 | |
| /U4uQ=; b=sdwprZTjQrfUlPEqtvK0vXV11+w7706TAvEagf0yj+lkjYEZE5bXN7 | |
| M+dJ9MclFfoO1K8hlD0toVY5J2PgyXtY4X/FVlLBYSKPAedM+s3QvrOPPHNUqrOP | |
| 8yNbzwRfuK2BOv1lRU6heIeO3UBy6JTxi7DDo+sCfVvK918sIdi/8= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-3.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2 |
| X-HELO: | smtpback.ht-systems.ru |
| Date: | Tue, 17 Jun 2014 20:34:19 +0400 |
| From: | Andrey Repin <anrdaemon AT yandex DOT ru> |
| Reply-To: | cygwin AT cygwin DOT com |
| Message-ID: | <1195111819.20140617203419@yandex.ru> |
| To: | Ernie Rael <err AT raelity DOT com>, cygwin AT cygwin DOT com |
| Subject: | Re: Change PS1 when running as administrator |
| In-Reply-To: | <53A06B0D.9050806@raelity.com> |
| References: | <1402994703 DOT 51470 DOT YahooMailNeo AT web172206 DOT mail DOT ir2 DOT yahoo DOT com> <53A06B0D DOT 9050806 AT raelity DOT com> |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
Greetings, Ernie Rael!
> On 6/17/2014 1:45 AM, GrahamC wrote:
>> If we are looking for other alternatives the GROUPS environment variable can also be used:
>>
>> PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
>> for G in "${GROUPS[@]}"; do
>> if [ "$G" = 544 ]; then
>> PS1='\[\e]0;Administrator \w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n# '
>> fi
>> done
> Speaking of alternatives,
> For matching in bash, something like
> [[ $(id -G) =~ \b544\b ]]
> was suggested (the suggestion used symbolic name instead of a number and
> didn't use word boundary). Seems like word boundary is needed, but I
> couldn't get this to work. Are the regex boundary matchers not
> supported by bash =~ operator?
I don't think bash equivalent of test implements Perl RE.
Neither the base test implementation, to that extent.
> Can use something like
> id -G | grep -q "\b544\b"
> (or echo ${GROUPS[@]} | ...)
--
WBR,
Andrey Repin (anrdaemon AT yandex DOT ru) 17.06.2014, <20:30>
Sorry for my terrible english...
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |