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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=rHzRkgpwU7GIZyhU nPPRmqGEPpVpcrkMo8OCllTdZdsCK7qD7Zi5FniAc8fbQskbgrREfhn/f2HFC1uk aD8ESvVt7VCOwsyja28nRnGQEwocxzO51pwE+8cXvseG7Wx2nHhv+Ql0cjGFJ7pQ UVvLW6e++Us+J4llZz/pJds1wtU= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=gprQIoYJ0/fijLAeugXBZe 8cc/A=; b=M7/sR0ri4x5fm/RfGK72SJzDz8RiHZHGuE0tJsvwDyc7w69Yy6NgLE LtzuUMsgBUn1pBmRzYHI1gou7zyM7v+5bEbmXf1o7ZRJfE88vsncXLjoIyspqEQq X82KhCfDfI25JKTiVuZmzc7/4hEUCnBOvw8gJXxgEloqpCEMOVWiY= 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=0.9 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=schrieb, 15.03.2016, HX-HELO:sk:mout.ku, H*RU:sk:mrelaye X-HELO: mout.kundenserver.de Subject: Re: Change PS1 when run as administrator To: cygwin AT cygwin DOT com References: <98egebtkn3kakah2g5m9nhr393mag7qm8j AT 4ax DOT com> <20160315170819 DOT GA11488 AT calimero DOT vinschen DOT de> From: Thomas Wolff Message-ID: <56E87FF2.3080100@towo.net> Date: Tue, 15 Mar 2016 22:34:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20160315170819.GA11488@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-UI-Out-Filterresults: notjunk:1;V01:K0:2g40c467GbI=:60NNEMkFIoGvZZvG0rsj2e CqNIChW7P8vY22Cy7LHZwM9NZh1zb9SKwZLnPQ2+1S9BAheT0ilVhRCW3hmbjiZchbfiavOEP Lmx1shO7T0Zsgs7mStt8lejbU0pnIH+nJd278sIsuO9NG7IJZrqatVM3oWzG1pqVW2ukZJ4B6 tIcA3+pxm2YrqT46p/iLm5w1u0dvdNYZ6h/RObIrq6IhwoSwSjE/IETABKYxsbk53l5Qo+0Xn sgbjZA7x4ePP9aLuWKGKDGbTyJNZY6NOarGzgxOleTZ9iHGKV+QTakOsearBZIrvQy3LbZrrb fPe126mYpiP/HhO05Dt8baXhoTIYVRas8BNqkLCppQ/ecdk4codXBBbADE5MuepeKfRceTEBN 2o/X2imVGvUct2FI78GK4EmBNtkarRn3PEZfSYemn5volTgdyPYEpu0/ZLIUADbzBGN2LFS4W TD1L4EClCMASiGfoKCrX1LxCMC1MQUTaGWpWB7XQWB1UjwQNqOpdOrLec+4jUFl6wKUftkmQK WUqpOc/D8+4HVcJmKJrlqa3H6pLapNf9KR3uHimqPs2hW0I0G98PKkcXdjfd41teyoS0eA/ld xx8KeYvcr9OG7TQHvDqKvP6z+5VKSlkjhIZtHmQ2LrQqQmkihCcXrPL31T7f8/5mnqBqwl/K/ GnkwtpInskLxKpLr6d9GM+xtupYSCmW1lwr13R8OSylmEmqZ29mBTtzKElPHcCUFBX59Dlz2j PX31aqYgI4H1WxpK X-IsSubscribed: yes Am 15.03.2016 um 18:08 schrieb Corinna Vinschen: > On Mar 15 12:33, Andrew Schulman wrote: >>> I just came up with this recipe to change the default PS1 value to use red for the user AT host part of the prompt and to change the $ character to a #: >>> >>> if id | grep -qi 'member of administrators group' >>> then >>> export PS1=$(echo "$PS1" | sed -e 's_32_31_' -e 's_\\\$_#_') >>> fi >>> >>> I’m not certain the string match on the output of id(1) works everywhere. Is there a better way to check for admin privileges under Cygwin? You can’t check for UID or EUID == 0, for example, as you’d do on a true POSIX system. >> Ha! Yes, there is: see >> https://cygwin.com/ml/cygwin/2015-02/msg00057.html. The magic test is >> >> id -G | grep -qE '\<(544|0)\>' >> >> where 544 is the Administrators group, and 0 is the root group in case the >> old root group entry is present in /etc/group. >> >> For example: >> >> id -G | grep -qE '\<(544|0)\>' && echo admin || echo user > Thou shalt not use the test for gid 0 anymore. If it works, remove the > entry from /etc/group, or better, remove /etc/group entirely. This entry > will render wrong and unwanted results when you least expect them. Such > cruft always does. So id -G | grep -q '\<544\>' I suppose. Is there also a universal replacement for elif id | grep -e "gid=.*(Power Users)" > /dev/null ? Thomas -- 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