你可能需要做
setopt prompt_subst
,如果它是不是已經。
此外,爲了解釋爲標籤的八進制轉義,使用$''
:
PS4=$'+ $(date "+%s.%N")\011 '
你也可以找到一些這些逃逸的是有用的:
%? The return status of the last command executed just before the prompt.
%_ The status of the parser, i.e. the shell constructs (like `if' and `for') that have been started on the command
line. If given an integer number that many strings will be printed; zero or negative or no integer means print as
many as there are. This is most useful in prompts PS2 for continuation lines and PS4 for debugging with the
XTRACE option; in the latter case it will also work non-interactively.
%i The line number currently being executed in the script, sourced file, or shell function given by %N. This is most
useful for debugging as part of $PS4.
%I The line number currently being executed in the file %x. This is similar to %i, but the line number is always a
line number in the file where the code was defined, even if the code is a shell function.
%L The current value of $SHLVL.
%N The name of the script, sourced file, or shell function that zsh is currently executing, whichever was started
most recently. If there is none, this is equivalent to the parameter $0. An integer may follow the `%' to spec‐
ify a number of trailing path components to show; zero means the full path. A negative integer specifies leading
components.
%x The name of the file containing the source code currently being executed. This behaves as %N except that function
and eval command names are not shown, instead the file where they were defined.
請考慮編輯您的文章,包括「在這個例子中回答提示節」,你找到相關的,並指出它是不是適合你現在的工作。祝你好運。 – shellter 2012-01-17 18:59:52
本質上,我只是需要將這些轉換爲zsh等價物,以便在我尋找定製之後加上我的提示。 :D我沒有定製它大約一年,所以我不得不挖掘部分備份,我把它埋在oh-my-zsh定製中。 – ylluminate 2012-01-17 19:30:56