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


Groups > linux.debian.user > #239697

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-05 06:30 +0200
Message-ID <CTRX3-4q2-1@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>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri 03 Sep 2021 at 02:45:03 (+0100), piorunz wrote:
> On 03/09/2021 01:34, David Wright wrote:
> > (I use my own customisations for distinct colours on each host,
> > and inverse colours for root's prompt.)
> 
> Can you please share your root prompt invocation? Thanks!

Sure. The colours come from a set of files by hostname:

$ 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
        PS1='\['$(tput setaf 3)$(tput setab 1)'\]$Myprompt\['$(tput bold)$(tput setaf 7)$(tput setab "$Hue")'\]\H \t \w\['$(tput sgr0)'\]\$ '
    else
        PS1='—$Myprompt—\H \t \w\$ '
    fi

    #hexdump -C <<<"$PS1"

fi

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