在Fish Shell中抑制或自定义简介消息

Suppress or Customize Intro Message in Fish Shell

是否可以删除鱼壳中的介绍消息:

Welcome to fish, the friendly interactive shell

Type help for instructions on how to use fish


Kevin的答案适用于静态文本。 如果您需要交互式欢迎消息,例如我的涉及fortune命令,您可以这样做

1
function fish_greeting

创建fish_greeting功能。 我只有

1
2
3
function fish_greeting
    fortune
end

并保存

1
funcsave fish_greeting


发现问候消息在fishd.Machine.local中设置。 要将以下内容覆盖到~/.config/fish/config.fish

1
set fish_greeting


Warning: No longer works since fish 2.4.0—see Kevin's answer for the correct contemporary solution.

如果没有名为"fish_greeting"的环境变量,则不会打印任何内容。 默认情况下,有一个fish_greeting变量。 你可以删除这个:

1
set --erase fish_greeting


1
> set --universal fish_greeting

set fish_greeting添加到~/.config/fish/config.fish文件中。

Fish常见问题解答如下:

How do I run a command every login? What's fish's equivalent to .bashrc?

Edit the file ~/.config/fish/config.fish, creating it if it does not exist (Note the leading period).

How do I change the greeting message?

Change the value of the variable fish_greeting or create a fish_greeting function. For example, to remove the greeting use:

1
set fish_greeting

请阅读官方文件。

http://fishshell.com/docs/current/faq.html#faq-greeting

简答:set -e fish_greeting