Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #239601
| From | IL Ka <kazakevichilya@gmail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Why ``color_prompt`` is only set for ``xterm``? |
| Date | 2021-09-03 02:20 +0200 |
| Message-ID | <CT562-5UL-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
Hi
.bashrc on bullseye contains following lines
```
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
```
So we only have colors in the terminal emulator, but not in virtual
linux console.
This could be fixed by one more hardcode
``
xterm-color|*-256color|linux) color_prompt=yes;;
``
But more robust way is something like:
```
if [ -x /usr/bin/tput ] && [ `/usr/bin/tput colors` -gt 1 ]; then
color_prompt=yes
fi
```
I do not know how much people care about console these days, but why have
hardcode if we can check the number of colors?
Ilya.
Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll 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