ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Andrew Fefilov <faqa@ies.udm.ru>
To: community@altlinux.ru
Subject: Re: [Comm] Re: PS1 in bash
Date: Wed, 16 Apr 2003 16:20:25 +0500
Message-ID: <20030416112025.GA6741@faa.ies.udm.ru> (raw)
In-Reply-To: <20030416143735.1d3b991a.vsu@altlinux.ru>

On Wed, Apr 16, 2003 at 02:37:35PM +0400, Sergey Vlasov wrote:
> On Wed, 16 Apr 2003 11:08:29 +0500
> Andrew Fefilov <faqa@ies.udm.ru> wrote:
> 
> > Подскажите, пожалуйста, если не в лом. Вот захотелось мне раскрасить
> > приглашение командной строки в bash. В М2.2 стандарное значение для этого
> > :
> > [faqa@faa faqa]$ set | grep PS1
> > PS1='[\u@\h \W]\$ '
> > 
> > Оно, вообщем-то, меня устраивает. Просто хотелось его раскрасить, скажем, в
> > зелёненький. Вот сделал так:
> > 
> > [faqa@faa faqa]$ set | grep PS1
> > PS1='\033[32m[\u@\h \W]\$ \[\033[0m'
> > 
> > Т.е. сначала крашу в зелёный, затем вывожу стандартное приглашение, затем
> > сбрасываю цвет символов в умолчательный. Все так и работает, но, если
> > командная строка занимает более одной строчки, то она продолжается не со
> > следующей строчки, а затирает начало первой строчки. Где это можно
> > подправить? Вот сижу, грепаю man bash, но пока безуспечно.
> 
> Вокруг управляющих последовательностей надо ставить "\[" и "\]", чтобы
> указать, что эти коды не занимают места на экране.

Спасибо большое, Сергей, все получилось. Теперь это выглядит так:

[faqa@faa faqa]$ set | grep PS1
PS1='\[\033[32m\][\u@\h \W]\$ \[\033[0m\]'

--------------
С уважением,
Фефилов Андрей.


      reply	other threads:[~2003-04-16 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-16  6:08 [Comm] " Andrew Fefilov
2003-04-16 10:37 ` [Comm] " Sergey Vlasov
2003-04-16 11:20   ` Andrew Fefilov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030416112025.GA6741@faa.ies.udm.ru \
    --to=faqa@ies.udm.ru \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git