delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/22/19:15:11

X-Spam-Check-By: sourceware.org
Message-ID: <BAY104-F23586B23992790AC1B9DA6AD550@phx.gbl>
X-Sender: rbody99 AT hotmail DOT com
In-Reply-To: <Pine.GSO.4.63.0511221507290.26963@slinky.cs.nyu.edu>
From: "Robert Body" <rbody99 AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: escape codes in ksh "\033]0;\$PWD\007\$PWD> "
Date: Tue, 22 Nov 2005 17:14:57 -0700
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

I have not been able to figure out how to send escape codes to ksh

I saw a syntax for ksh on 
http://www.steveshilling.pwp.blueyonder.co.uk/scripts/xtermtitle.txt
---------
PS1='^[]0;${USER}@${HOST}: ${PWD}^Gksh$ '
---------
where ^[ is used instead of \033 and ^G instead of \007
but I tried 3 systems with ksh, no go, it doesn't understand escape 
characters, not with \032, not with \[\e and not with ^[ to signfy beginning 
of escape code... ksh just repeats them exactly like regular characters


in bash it's easy
--------
PS1='\[\e]0;$PWD\a\]$PWD> '        # (in title) HOST-$PWD ... $PATH>
--------

I came up with the following... needs perl, needs xterm
but works in ksh, and bash too
--------
PS1=$(perl -e 'printf "\033]0;\$PWD\007\$PWD> "')
--------

but i just don't know how (and someone must know how) people get the escape 
codes into ksh that it works from command prompt or script with a one line 
solution (and without secondary help from something like c or perl code)

Oh, the purpose of this escape sequence is to synchronize the title with PS1 
to be the current directory on an xterm (but the question is about escape 
codes, not xterm ;-) )

-Robert



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019