From b77e2a67f8c3a2faf32c04926aaaea7572abcbba Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 30 Jul 2016 22:47:17 -0700 Subject: [PATCH] Only do fish_greeting if interactive Even if __fish_config_interactive, it can be shown when a script uses `read`. Fixes #3261, #1401. --- share/functions/__fish_config_interactive.fish | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 43b369518..630450c5c 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -110,13 +110,15 @@ 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 + 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 #