zsh-users
 help / color / mirror / code / Atom feed
* reinventing print_exit_value
@ 2005-07-03 21:56 Christian Taylor
  2005-07-03 22:32 ` Nikolai Weibull
  2005-07-04 14:32 ` Bart Schaefer
  0 siblings, 2 replies; 11+ messages in thread
From: Christian Taylor @ 2005-07-03 21:56 UTC (permalink / raw)
  To: zsh-users

Hi all,

I recently decided that I want the exit code of the last command (if it's 
greater than 0) displayed after invoking it, like the PRINT_EXIT_VALUE option 
does, but in my own format. (I don't want to include it in my prompt.)
I added the necessary code to the precmd function, which lead to the following 
undesired behaviour:

% false
(1)
% <just hitting enter>
(1)
%

To achieve the intended behaviour, I now let the preexec function set a 
variable to 1, and let the precmd function print the exit value only if this 
variable is set to 1 (afterwards setting it to 0). This works because the 
preexec function is only invoked if a real command is executed, not if you 
attempt to "execute" whitespace or nothing.

However: is there a simpler way to achieve this? My solution seems a bit 
inelegant to me.

Thanks,

Christian


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-07-04 22:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-03 21:56 reinventing print_exit_value Christian Taylor
2005-07-03 22:32 ` Nikolai Weibull
2005-07-03 23:04   ` Christian Taylor
2005-07-03 23:35     ` Nikolai Weibull
2005-07-04  0:09       ` Christian Taylor
2005-07-04 12:29         ` Nikolai Weibull
2005-07-04 13:24           ` J
2005-07-04 13:25             ` J
2005-07-04 14:29           ` Christian Taylor
2005-07-04 14:32 ` Bart Schaefer
2005-07-04 22:32   ` Christian Taylor

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).