Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

functions in prompts evaluated twice?



Hey list,

I was about to use the output of a function in my prompt, when I
noticed, that it was evaluated twice.

[snip]
(6006)-~% zsh -f
zsh% setopt promptsubst
zsh% foo () { sleep 2 ; }
zsh% PROMPT='$(foo)%# '
% set -x
+zsh:1> foo
+foo:0> sleep 2
+zsh:1> foo
+foo:0> sleep 2
% 
[snap]

Is that supposed to be the way it is or is that a bug?

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



Messages sorted by: Reverse Date, Date, Thread, Author