delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/06/16/07:25:12

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:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=R6cF029xXR0aW2T/Og7GLPzVJNqr1
l35r3J4ecZ92dN3UGBxvfwkafCalz70DIUKfpEFwlCZU7Gd/Dgagr5LEuSmR1eXs
8VsZ+6driKL8JOepsXkUoAtmYwDrCTPjxnJB1i4TVM//utxihF1qbWLIzp8kBJIC
YJ9Z2npFsitwUE=
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:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=D/JEfSsl+PkofBZ/+Aa4BvNagOY=; b=Zz7
SWaC30DPuwxAKrSAt5vq92pDhVfDhQ2ncF/1gGEslQ5spufhR8/2kEAN88skS43F
M6yk1DWk6aQXiVxBixZSBRE7akyIyCS6kQ0Jt5++4W9PGjDX7C7Bxv/KTj2ILUoi
XW9WDx9NWeP8tiFzAVZSVvYKXku8U9VpNkDxhc8Q=
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=0.1 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: s87.webhostingserver.nl
X-Received: by 10.112.12.103 with SMTP id x7mr12625322lbb.36.1402917888576; Mon, 16 Jun 2014 04:24:48 -0700 (PDT)
MIME-Version: 1.0
From: Frank Fesevur <ffes AT users DOT sourceforge DOT net>
Date: Mon, 16 Jun 2014 13:24:18 +0200
Message-ID: <CAKf2h5TWGDwFj-wCav6Skqae+iaLHHtsGBWy1sS9v-PcaJxh3Q@mail.gmail.com>
Subject: Change PS1 when running as administrator
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
X-IsSubscribed: yes

Hi,

I recently bought a new home computer, so I switched from XP to Win81.
With Win81 every now and then I need to start cygwin as administrator
(right click shortcut or tile, run as administrator) to do things that
I can't do as a normal user.

When I run as administrator I change my PS1 from "$" to "#" with these
line in ~/.bashrc.

if id -Gn | grep -i Administrators > /dev/null
then
    PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n# '
else
    PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
fi

I don't know if the test can be done a better/easier way, but it works
for me on a Dutch Win81. I tested it with both 1.7.30 and a recent
AD/SAM snapshot.

If more people like this idea, maybe it could included in /etc/bash.bashrc?

Regards,
Frank

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