fish scripts always print the $fish_greeting welcome message before the "read" command prompt

  • Have you checked if problem occurs with fish 2.3.1?
  • Tried fish without third-party customizations (check sh -c 'env HOME=$(mktemp -d) fish')?

fish version installed (fish --version):
2.3.1

OS/terminal used:
Fedora 24 (64-bit) / GNOME Terminal 3.20.2

I'm writing a simple script that uses the read command to get info from the user before continuing. Every time the script runs, when it gets to the first read line, it prints the $fish_greeting, which I find a little distracting.

The only workaround I've been able to figure out is to set fish_greeting to an empty string -- however, even when I use set --local, that seems to permanently remove the fish greeting for all future sessions, not just when running the script. Some users of my script may not like that.

Here's an example script that consistently prints the fish greeting when it reaches the read line.

#!/usr/bin/fish
echo "What's your name?"
read name
echo "Hello, $name!"