Don't show greetings in read in scripts

This reverts commit 1b0ec2177305ed15c5a6630a0a3068dcbc64835f.

"Interactive" has multiple meanings here, one of them being "the whole shell" is interactive, which `status is-interactive` tests, and one "this interaction is interactive", which happens when `read`ing in a script.

Fixes #7080.
This commit is contained in:
Fabian Homborg 2020-06-04 16:57:35 +02:00
parent 4dff15b74e
commit 0064279905

View File

@ -114,13 +114,16 @@ function __fish_config_interactive -d "Initializations that should be performed
# Print a greeting.
# fish_greeting can be a function (preferred) or a variable.
#
if functions -q fish_greeting
fish_greeting
else
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
# Keep it that way to not print superfluous newlines on old configuration
test -n "$fish_greeting"
and echo $fish_greeting
# NOTE: This status check is necessary to not print the greeting when `read`ing in scripts. See #7080.
if status --is-interactive
if functions -q fish_greeting
fish_greeting
else
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
# Keep it that way to not print superfluous newlines on old configuration
test -n "$fish_greeting"
and echo $fish_greeting
end
end
#