delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/03/15/14:38:24

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:from:to:subject:references:date:in-reply-to
:message-id:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=Thn6YpRNV864Q6FsvtsY7dqaNrRyn9WaWnqllgDggoz
dEgSbHJpqN3xI2JYCLdoof/8B4ZkIPsj1WKgLJJOXsaahTGj/h6EorCcqATu0WSB
LhOb1SQKbK0AXXB8/+JJsmRjeG982Llha5yef7U7oi4qoSgBvWv48pKq41m69PP8
=
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:from:to:subject:references:date:in-reply-to
:message-id:mime-version:content-type:content-transfer-encoding;
s=default; bh=ngXKPNjUgpe9GVL18uJd/VAhiS0=; b=nVs2w50XHzSE6rS26
Mc+gpZy+UqPFl7MIbMYEteNivBcRmQ/bouLLF+S+LVfVb5p+xLjFYaWvZvymEsrm
sP9W2pmH2bdIY5GmWrrSr/qKl0tW17JCsgUVWFMS84riasp1B5h6dLm40akAD3Z+
I1XPKFj41lPAvOc3weQ8ZTa7vk=
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=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Young, interactive, warren, shells
X-HELO: mail-in-12.arcor-online.net
X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-16.arcor-online.net 3qPjzX28BBz4QK5
From: Achim Gratz <Stromeko AT nexgo DOT de>
To: cygwin AT cygwin DOT com
Subject: Re: Change PS1 when run as administrator
References: <F7CDFE45-BFA7-4599-B510-B40BCA19142F AT etr-usa DOT com>
Date: Tue, 15 Mar 2016 19:37:56 +0100
In-Reply-To: <F7CDFE45-BFA7-4599-B510-B40BCA19142F@etr-usa.com> (Warren Young's message of "Tue, 15 Mar 2016 10:20:00 -0600")
Message-ID: <87d1qv37uj.fsf@Rainer.invalid>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux)
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u2FIcKAr004196

Warren Young writes:
> 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.

{ id -G | grep -Eq '^544$'; } && echo admin || echo nope

> Perhaps something like this should go into the default /etc/profile?

No, since it gets read for all shells, not just interactive ones.  The
only reason the prompt is set at all in /etc/profile on Cygwin is that
there is no init/login process to initialize it.  But you can always
place a script to that effect into /etc/profile.d if you absolutely want
it there anyway.  I think putting these in the ENV file is preferrable.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019