在 macOS 中名为 "prompt" 的 zsh 命令?
zshell command named "prompt" in macOS?
我正在使用适用于 macOS Catalina (10.15.6) 的 zshell。 《Learning Shell Scripting With Zsh》一书描述了一个名为 prompt
的可执行命令,可用形式如下:
$ prompt -p
$ prompt -h
$ prompt <theme_name>
$ prompt adam1 red yellow magenta
但是zsh报“找不到命令:提示”。
如何获取该命令或等效命令。
(我试图搜索的所有地方都给我提供了指向解释如何设置 zsh 提示的地方的链接,以及所有常用的转义序列、“$...”符号等)
来自man zshcontrib
:
PROMPT THEMES
Installation
You should make sure all the functions from the Functions/Prompts
directory of the source distribution are available; they all begin with
the string `prompt_' except for the special function`promptinit'. You
also need the `colors' and `add-zsh-hook' functions from Func-
tions/Misc. All these functions may already be installed on your sys-
tem; if not, you will need to find them and copy them. The directory
should appear as one of the elements of the fpath array (this should
already be the case if they were installed), and at least the function
promptinit should be autoloaded; it will autoload the rest. Finally,
to initialize the use of the system you need to call the promptinit
function. The following code in your .zshrc will arrange for this;
assume the functions are stored in the directory ~/myfns:
fpath=(~/myfns $fpath)
autoload -U promptinit
promptinit
因此,要获得 prompt
命令,您只需 运行
$ autoload -U promptinit
$ promptinit
我正在使用适用于 macOS Catalina (10.15.6) 的 zshell。 《Learning Shell Scripting With Zsh》一书描述了一个名为 prompt
的可执行命令,可用形式如下:
$ prompt -p
$ prompt -h
$ prompt <theme_name>
$ prompt adam1 red yellow magenta
但是zsh报“找不到命令:提示”。
如何获取该命令或等效命令。
(我试图搜索的所有地方都给我提供了指向解释如何设置 zsh 提示的地方的链接,以及所有常用的转义序列、“$...”符号等)
来自man zshcontrib
:
PROMPT THEMES
Installation
You should make sure all the functions from the Functions/Prompts
directory of the source distribution are available; they all begin with
the string `prompt_' except for the special function`promptinit'. You
also need the `colors' and `add-zsh-hook' functions from Func-
tions/Misc. All these functions may already be installed on your sys-
tem; if not, you will need to find them and copy them. The directory
should appear as one of the elements of the fpath array (this should
already be the case if they were installed), and at least the function
promptinit should be autoloaded; it will autoload the rest. Finally,
to initialize the use of the system you need to call the promptinit
function. The following code in your .zshrc will arrange for this;
assume the functions are stored in the directory ~/myfns:
fpath=(~/myfns $fpath)
autoload -U promptinit
promptinit
因此,要获得 prompt
命令,您只需 运行
$ autoload -U promptinit
$ promptinit