Suppress or Customize Intro Message in Fish Shell

烂漫一生 提交于 2019-12-03 01:16:02

问题


Is it possible to remove the intro message in fish shell:

Welcome to fish, the friendly interactive shell

Type help for instructions on how to use fish


回答1:


Kevin's answer works fine for static text. If you need an interactive welcome message, such as mine involving the fortune command, you can do

function fish_greeting

Create your fish_greeting function. I just have

function fish_greeting
    fortune
end

and save it with

funcsave fish_greeting



回答2:


Found that the greeting message is set in fishd.Machine.local. To override the following to ~/.config/fish/config.fish:

set fish_greeting



回答3:


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

If there is no environment variable named "fish_greeting", then nothing will be printed. By default, there is a fish_greeting variable. You can erase this:

set --erase fish_greeting



回答4:


> set --universal fish_greeting



回答5:


Add set fish_greeting to your ~/.config/fish/config.fish file.

This is answered in the Fish FAQ:

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:

set fish_greeting



回答6:


Read the official document please.

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

short answer: set -e fish_greeting




回答7:


Create your fish_greeting function. I just have

function fish_greeting                                             13:23:39
    echo 'Hello'
end 

and save it with

funcsave fish_greeting


来源:https://stackoverflow.com/questions/13995857/suppress-or-customize-intro-message-in-fish-shell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!