gpt4 book ai didi

macos - macOS 中名为 "prompt"的 zshell 命令?

转载 作者:行者123 更新时间:2023-12-04 08:53:32 25 4
gpt4 key购买 nike

我正在为 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 - macOS 中名为 "prompt"的 zshell 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63973100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com