Thread View: gnu.bash.bug
5 messages
5 total messages
Started by Rich Salz
Thu, 14 Sep 1989 16:25
Seeing control characters in aliases and functions
Author: Rich Salz
Date: Thu, 14 Sep 1989 16:25
Date: Thu, 14 Sep 1989 16:25
28 lines
1204 bytes
1204 bytes
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.
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...
: ;
}
--
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.
Seeing control characters in aliases and functions
Author: Brian Fox
Date: Thu, 14 Sep 1989 21:24
Date: Thu, 14 Sep 1989 21:24
45 lines
1756 bytes
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
Re: Seeing control characters in aliases and functions
Author: Rich Salz
Date: Thu, 14 Sep 1989 22:16
Date: Thu, 14 Sep 1989 22:16
27 lines
1275 bytes
1275 bytes
In <8909142124.AA25167@aurel.caltech.edu> bfox@aurel.caltech.edu suggests
I fix my "pwd" function to use "echo -e":
function pwd () {
echo -n -e "\033]lBASH@${host}(${TTY}):$PWD\033\010"
}
Hand smacks head, and voice goes "duh."
>Thanks for the neat function!
No prob. Of course, it makes the most sense when used with this:
function cd() {
builtin cd $*;
pwd
}
and similar functions for pushd/popd.
I re-complained about
> function bxmf() {
> make -k "$@" >foo 2>&1 &
> # why is the next line necessary?
> : ;
> }
Brian pointed out that it isn't in 1.03.... hand smacks the head
again, voice goes "try it before posting."
/r$
--
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.
Re: Seeing control characters in aliases and functions
Author: Ray Nickson
Date: Thu, 14 Sep 1989 22:28
Date: Thu, 14 Sep 1989 22:28
57 lines
2330 bytes
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
Re: Seeing control characters in aliases and functions
Author: Chet Ramey
Date: Fri, 15 Sep 1989 20:03
Date: Fri, 15 Sep 1989 20:03
16 lines
1125 bytes
1125 bytes
In article <8909142231.AA08032@comp.vuw.ac.nz> nickson@comp.vuw.ac.nz (Ray Nickson) writes:
>BTW, Will functions ever have real argument lists?:
>xsettitle (t) { echo -n -e "\033]2 $t\007"; }
Functions already have "real argument lists". The only problem is that the
arguments are always named "$1", "$2", and so on.
;-)
Chet Ramey
Chet Ramey "We are preparing to think about contemplating
Network Services Group, CWRU preliminary work on plans to develop a
chet@cwjcc.INS.CWRU.Edu schedule for producing the 10th Edition of
the Unix Programmers Manual." -- Andrew Hume
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads