🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #590

Seeing control characters in aliases and functions

#590
From: Brian Fox
Date: Thu, 14 Sep 1989 21:24
45 lines
1756 bytes
   Date: 14 Sep 89 16:25:22 GMT
   From: rsalz@bbn.com  (Rich Salz)
   Organization: BBN Systems and Technologies Corporation
   Sender: bug-bash-request@prep.ai.mit.edu

   Given these functions:
       TTY=`tty | sed -e s:/dev/ttyp::`
       host=`hostname | tr a-z A-Z | sed -e s/.BBN.COM//`

       function pwd() {
	   # This has two ESCAPEs and one BACKSPACE in it.
	   echo -n "^[]lBASH@${host}(${TTY}):$PWD^[\^H"
       }

       function cd() {
	   builtin cd $*;
	   pwd;
       }

   When I say "type pwd" my window banner gets all messed up.

That's because you didn't use the -e flag on the echo command which
would allow you to type in those escapes in ASCII representation:

	function pwd () {
	  echo -n -e "\033]lBASH@${host}(${TTY}):$PWD\033\010"
        }

Thanks for the neat function!

   Also, while I'm here:
       function bxmf() {
	   make -k "$@" >foo 2>&1 &
	   #  It doesn't seem quite right that this next line is really needed...
	   : ;
       }

It isn't.  You have mentioned this a couple of times.  In 1.03, you
don't even need to end the list with a terminator, but even in prior
versions the newline character (or ampersand) is enough.

	function bxmf () { make -k "$@" >foo 2>&1 & }

Brian Fox
Technical Details
Message-ID: <8909142124.AA25167@aurel.caltech.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
References: <1952@prune.bbn.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
From: bfox@AUREL.CALTECH.EDU (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: Seeing control characters in aliases and functions
Message-ID: <8909142124.AA25167@aurel.caltech.edu>
Date: 14 Sep 89 21:24:53 GMT
References: <1952@prune.bbn.com>
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: bfox@aurel.caltech.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 45