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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=rUpZRph0v+2pNC9vTBAGn4i4RacTh0TQ1W8Izcls1pt vjT17XHvE4VrLELuVS6WGbJxZoDsTm387EfAUUi8o0Qk8P1CG8TUoMEX2OymT2vQ 26/zs8MJv+oKaZAB4+EokgxGf2QFP/AZzQO69RD7CsczErx2EPxex+oDbvbCzQGQ = 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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=tlm5ed7r5lNDYLEhhTAhRrH3vLg=; b=O9c5zVr37eLJ3ONuo LXkEy6lwWutEykkCwOUeu/0M5U8agbDpQHpbs5/l015TVs7pUyezhf8URg0lj535 MSzIPVORrjhqHg/1HpgC0h5vqUwYOm1nCTSDTGH5O33ocGT9ax3rCsPxyyJ+hUGw jyqBu/clVb5nKCiBl1ghTdEb8U= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=1.5 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: qmta13.emeryville.ca.mail.comcast.net Message-ID: <53A06B0D.9050806@raelity.com> Date: Tue, 17 Jun 2014 09:21:33 -0700 From: Ernie Rael User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Change PS1 when running as administrator References: <1402994703 DOT 51470 DOT YahooMailNeo AT web172206 DOT mail DOT ir2 DOT yahoo DOT com> In-Reply-To: <1402994703.51470.YahooMailNeo@web172206.mail.ir2.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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? Can use something like id -G | grep -q "\b544\b" (or echo ${GROUPS[@]} | ...) -ernie -- 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