From e1f623f548c0e6241642db96c522c411cd84d755 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Sun, 21 Sep 2014 20:33:58 -0700 Subject: [PATCH] Only print fish_greeting for interactive shells Shell scripts that use `read` should not trigger fish_greeting. Fixes #1401. --- .../functions/__fish_config_interactive.fish | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 173c7456f..45b2e710b 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -149,20 +149,22 @@ function __fish_config_interactive -d "Initializations that should be performed eval "$__fish_bin_dir/fish -c 'fish_update_completions > /dev/null ^/dev/null' &" end - # - # Print a greeting - # + if status -i + # + # Print a greeting + # - if functions -q fish_greeting - fish_greeting - else - if set -q fish_greeting - switch "$fish_greeting" - case '' - # If variable is empty, don't print anything, saves us a fork + if functions -q fish_greeting + fish_greeting + else + if set -q fish_greeting + switch "$fish_greeting" + case '' + # If variable is empty, don't print anything, saves us a fork - case '*' - echo $fish_greeting + case '*' + echo $fish_greeting + end end end end