On 1 December 2010 21:42, Christoph Wurm<christoph@xxxxxxxx> wrote:
Hello,
I would like to display the exit code of a command if it is not 0 on a line
of its own, followed by the prompt on the next line.
Is this possible?
I was able to come up with the following:
PROMPT="%0(?..%?)
%{$fg[green]%}%n@%m%{$reset_color%}:%~ %{$fg[red]%}%#%{$reset_color%} "
However, this prints a newline after every command. Is there some equivalent
of '\n' that can be used inside the conditional substring? Or some other way
to do this?
Yes, a newline works fine.
% PS1='%0(?..%?
)%~> '
~> false
1
~> true
~>