Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh propmts
- X-seq: zsh-users 360
- From: Robert Stone <rstone@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: zsh propmts
- Date: Sun, 18 Aug 1996 03:42:47 -0500 (CDT)
I'd like to thank everyone who had anything to do with the "%_"
value for PS2 in zsh-3.0.0, I'm in love with it.
I've been attempting to set up a prompt that will show me any
non-zero return values, and print the names of any signal the last job
recieved. Right now I'm using two features of the shell to accomplish this:
function precmd { PSVAR=$signals[$?^128+1] }
PROMPT='%(?..%1(?.{%?}.%B{%?%2(v.. %v)}%b) )%m:%~%# '
Unfortunately I end up with $PSVAR = '.' if no signal has occured
because an invalid array subscription produces '.', such that my prompt
looks like:
aic1:~% return 15
{15 .} aic1:~% ls -l # I hit ^C here
{130 INT} darkstar:~%
The trick here is that I can't execute anything in precmd that would
effect $? or the "%?" value in the prompt is inaccurate. How could I clean
this so that PSVAR is set to a null string when $signals is given an invalid
subscript?
thanks,
Robert Stone
------------------rstone@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author