🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #591

Re: Seeing control characters in aliases and functions

#591
From: Ray Nickson
Date: Thu, 14 Sep 1989 22:28
57 lines
2330 bytes
   From:  rsalz@bbn.COM
   Date:  14 Sep 89 16:25:22 GMT

   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.  I know
   that being able to take your output as input is a good thing, but having
   to put "|cat -v" on the end all the time is a pain.

I use
    xsettitle () { echo -n -e "\033]2 $1\007"; }
    xseticon () { echo -n -e "\033]1 $1\007"; }
    XTITLE="$XPROG"
    xseticon "$XTITLE"
    xsettitle "$XTITLE   :   $PWD"
    cd () { builtin cd $@; xsettitle "$XTITLE   :   $PWD"; }
    pushd () { builtin pushd $@; xsettitle "$XTITLE   :   $PWD"; }
    popd () { builtin popd $@; xsettitle "$XTITLE   :   $PWD"; }

- no control chars needed!  (do help echo).

   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...
   	: ;
       }

Why _is_ it needed?  The function seems to work fine for me (1.02 or
1.03) without it.

BTW, Will functions ever have real argument lists?:
xsettitle (t) { echo -n -e "\033]2 $t\007"; }

BTW again: did the 1.03 patches Brian mentioned:
   I'm sorry that this bug appeared in 1.03.  I will be posting patches for
   this and a few other fixed bugs on Friday, Sep 8.
ever go out?  We lost touch with the world for a few days, and I'd
hate to have missed them.

-rgn
--
Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand.
nickson@comp.vuw.ac.nz       ...!uunet!vuwcomp!nickson      + 64 4 721000x8593
Technical Details
Message-ID: <8909142231.AA08032@comp.vuw.ac.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!comp.vuw.ac.nz!nickson
References: <1952@prune.bbn.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!comp.vuw.ac.nz!nickson
From: nickson@comp.vuw.ac.nz (Ray Nickson)
Newsgroups: gnu.bash.bug
Subject: Re: Seeing control characters in aliases and functions
Message-ID: <8909142231.AA08032@comp.vuw.ac.nz>
Date: 14 Sep 89 22:28:36 GMT
References: <1952@prune.bbn.com>
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 57