From owner-freebsd-questions@FreeBSD.ORG Sun Feb 7 07:43:41 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3ACAB106566B for ; Sun, 7 Feb 2010 07:43:41 +0000 (UTC) (envelope-from kamikaze@bsdforen.de) Received: from mail.bsdforen.de (bsdforen.de [212.204.60.79]) by mx1.freebsd.org (Postfix) with ESMTP id F0AA98FC13 for ; Sun, 7 Feb 2010 07:43:40 +0000 (UTC) Received: from mobileKamikaze.norad (unknown [88.130.212.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bsdforen.de (Postfix) with ESMTP id 5E77F8A159B; Sun, 7 Feb 2010 08:43:39 +0100 (CET) Message-ID: <4B6E6F24.3090609@bsdforen.de> Date: Sun, 07 Feb 2010 08:43:32 +0100 From: Dominic Fandrey User-Agent: Thunderbird 2.0.0.23 (X11/20100206) MIME-Version: 1.0 To: perryh@pluto.rain.com References: <4B6D62B3.4070702@bsdforen.de> <20100206125554.GA2173@current.Sisis.de> <4B6D74EF.2090106@bsdforen.de> <4B6D80F3.7050707@black-earth.co.uk> <4B6D8377.1090005@bsdforen.de> <4B6D9B6B.40800@bsdforen.de> <4b6e2885.uAuY+a00oT7AqSzy%perryh@pluto.rain.com> In-Reply-To: <4b6e2885.uAuY+a00oT7AqSzy%perryh@pluto.rain.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: guru@unixarea.de, m.seaman@black-earth.co.uk, freebsd-questions@freebsd.org Subject: Re: backup terminal title X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Feb 2010 07:43:41 -0000 perryh@pluto.rain.com wrote: >> I wish to use the "\033]0;%s\007" sequence in a shell-script to >> set the title of a terminal. But only if I am able to undo it. >> >> My requirement is that this must be done without using anything >> outside the base system. > > There is an escape sequence which will cause the terminal to echo > back its current title, but it's a bit tricky to use given only > base-system tools because the echo ends with, IIRC, \007 rather > than \n. It may be possible in some shells to temporarily set the > line-end character to \007. You probably also want to (somehow) > cover problematic cases like terminals that don't reply to the > inquiry even though TERMCAP implies that they should. That actually doesn't sound tricky at all, remember that the original sequence to change the title also ends with \007. Where can I find this magical sequence? I've been trying to read: http://www.xfree86.org/current/ctlseqs.html But the Syntax is really cryptic.