Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239772

Re: Why ``color_prompt`` is only set for ``xterm``?

From David Wright <deblis@lionunicorn.co.uk>
Newsgroups linux.debian.user
Subject Re: Why ``color_prompt`` is only set for ``xterm``?
Date 2021-09-07 17:10 +0200
Message-ID <CUKTw-5Po-3@gated-at.bofh.it> (permalink)
References <CT562-5UL-1@gated-at.bofh.it> <CT5pn-61K-3@gated-at.bofh.it> <CT6v8-6FH-3@gated-at.bofh.it> <CTRX3-4q2-1@gated-at.bofh.it> <CU04i-1ex-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun 05 Sep 2021 at 09:06:31 (-0400), Greg Wooledge wrote:
> On Sat, Sep 04, 2021 at 11:23:48PM -0500, David Wright wrote:
> > $ cat /var/local/lib/myhosts/colours/axis 
> > 5 magenta bbarbutton=white,magenta,none:bbarhotkey=magenta,white,none
> > $ 
> > 
> > 5 is for ANSI colours,
> > magenta is for, eg emacs, mutt, etc,
> > bbarbutton is for mc.
> > 
> > The lines from /root/.bashrc are:
> > 
> > if [[ $- = *i* ]]; then
> > 
> >     export PROMPT_COMMAND='Myprompt="$? " && [ "$Myprompt" = "0 " ] && Myprompt=""'
> > 
> >     # read value from file, and sanitise it
> >     Hue=$(head -c 1 /var/local/lib/myhosts/colours/"$HOSTNAME")
> >     if grep -q ·"$Hue"· <<<"·0·1·2·3·4·5·6·7·8·9·"; then
> 
> It's strange that you used shell builtins for the $- check but not
> for this check.
> 
> read -r Hue _ < /var/local/lib/myhosts/colours/"$HOSTNAME"
> if [[ $Hue = [0-9] ]]; then

Yes. The grep would have been copied from another line in my users'
version of processing that file:
grep -q ·"${Hues[1]}"· <<<"·brown·cyan·green·blue·magenta·red·" && Emacshue="${Hues[1]}"
and when I wrote that, I couldn't be bothered with constructing an OR
(IIRC: 'twas a long time ago).

OTOH   if [[ $- = *i* ]]; then   came from your recent
https://lists.debian.org/debian-user/2021/04/msg00381.html

> Or if you happen to use the other fields of that file later in the script,
> then change the read command to store all 3 fields in shell variables.

I do use an array (as above), but root doesn't, because root only uses
the prompt colour from that file. I don't run emacs, mc or mutt as root.

Two other trivia: root insists on no whitespace at the start, and
I don't think I need to export PROMPT_COMMAND because, unlike you,
I set both it and PS1 in .bashrc.

Cheers,
David.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why ``color_prompt`` is only set for ``xterm``? IL Ka <kazakevichilya@gmail.com> - 2021-09-03 02:20 +0200
  Re: Why ``color_prompt`` is only set for ``xterm``? David Wright <deblis@lionunicorn.co.uk> - 2021-09-03 02:40 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? Nicholas Geovanis <nickgeovanis@gmail.com> - 2021-09-03 03:10 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? piorunz <piorunz@gmx.com> - 2021-09-03 03:50 +0200
      Re: Why ``color_prompt`` is only set for ``xterm``? Mark Neyhart <Mark.Neyhart@akleg.gov> - 2021-09-03 22:00 +0200
        Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt examples) Intense Red <intnsred@golgotha.net> - 2021-09-05 07:30 +0200
          Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt examples) Cindy Sue Causey <butterflybytes@gmail.com> - 2021-09-05 14:20 +0200
          Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt  examples) Greg Wooledge <greg@wooledge.org> - 2021-09-05 15:10 +0200
            Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt examples) Cindy Sue Causey <butterflybytes@gmail.com> - 2021-09-05 15:40 +0200
              Re: Why ``color_prompt`` is only set for ``xterm``? (colored prompt  examples) Greg Wooledge <greg@wooledge.org> - 2021-09-05 15:50 +0200
      Re: Why ``color_prompt`` is only set for ``xterm``? David Wright <deblis@lionunicorn.co.uk> - 2021-09-05 06:30 +0200
        Re: Why ``color_prompt`` is only set for ``xterm``? Greg Wooledge <greg@wooledge.org> - 2021-09-05 15:10 +0200
          Re: Why ``color_prompt`` is only set for ``xterm``? David Wright <deblis@lionunicorn.co.uk> - 2021-09-07 17:10 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? Nate Bargmann <n0nb@n0nb.us> - 2021-09-05 18:50 +0200
    Re: Why ``color_prompt`` is only set for ``xterm``? Andrei POPESCU <andreimpopescu@gmail.com> - 2021-09-07 20:40 +0200

csiph-web