delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/19/18:18:50

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SARE_FREE_WEBM_LAPOSTE,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4BF463BA.3010507@laposte.net>
Date: Thu, 20 May 2010 00:18:34 +0200
From: Cyrille Lefevre <cyrille DOT lefevre-lists AT laposte DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Minor patch to /etc/profile
References: <l2m2bf229d31004302025pf27b058av70c01290b3275abf AT mail DOT gmail DOT com>
In-Reply-To: <l2m2bf229d31004302025pf27b058av70c01290b3275abf@mail.gmail.com>
X-me-spamlevel: not-spam
X-me-spamrating: 40.000000
X-me-spamcause: OK, (0)(0000)gggruggvucftvghtrhhoucdtuddrvdelvddrudekucetggdotefuucfrrhhofhhilhgvmecuoehnohhnvgeqnecuuegrihhlohhuthemuceftddtnecu
X-IsSubscribed: yes
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

Le 01/05/2010 05:25, Chris Sutcliffe a =E9crit :
> The PS1 definition for ksh in /etc/profile uses the literal ascii
> characters '^[' for the escape sequence as opposed to the single byte
> escape control code.  The attached patch corrects that as well as
> HOSTNAME not being set correctly (at least for mksh).

the right way to go would be something like :

the current way :
PS1=3D$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME}=20
\033[33m${PWD}\033[0m\n$ ')

w/ tilde expansion as bash does :
TILDE=3D\~
PS1=3D$(print=20
'\033]0;${TILDE[(1-0${PWD%%@([!/]*|${HOME}*)}1)]:-}${PWD#${HOME}}\n\033[32m=
${USER}@${HOSTNAME}=20
\033[33m${TILDE[(1-0${PWD%%@([!/]*|${HOME}*)}1)]:-}${PWD#${HOME}}\033[0m\n$=
=20
')

so, you can still print the file w/o side effects

Regards,

Cyrille Lefevre
--=20
mailto:Cyrille DOT Lefevre-lists AT laposte DOT net




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