Files
fish-shell/doc_src/cmds/fish_greeting.rst
Johannes Altmanninger 7a59540517 docs: use :doc: role when referencing entire pages
No need to define "cmd-foo" anchors; use :doc:`foo <cmds/foo>`
instead. If we want "cmd-foo" but it should be tested.

See also 38b24c2325 (docs: Use :doc: role when linking to commands,
2022-09-23).
2025-11-06 12:58:59 +01:00

44 lines
1.1 KiB
ReStructuredText

fish_greeting - display a welcome message in interactive shells
===============================================================
Synopsis
--------
.. synopsis::
fish_greeting
::
function fish_greeting
...
end
Description
-----------
When an interactive fish starts, it executes fish_greeting and displays its output.
The default fish_greeting is a function that prints a variable of the same name (``$fish_greeting``), so you can also just change that if you just want to change the text.
While you could also just put ``echo`` calls into config.fish, fish_greeting takes care of only being used in interactive shells, so it won't be used e.g. with ``scp`` (which executes a shell), which prevents some errors.
Example
-------
To just empty the text, with the default greeting function::
set -U fish_greeting
or ``set -g fish_greeting`` in :ref:`config.fish <configuration>`.
A simple greeting:
::
function fish_greeting
echo Hello friend!
echo The time is (set_color yellow)(date +%T)(set_color normal) and this machine is called $hostname
end