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

Closed
terrycloth opened this Issue Jul 24, 2016 · 6 comments

Projects

None yet

4 participants

@terrycloth
terrycloth commented Jul 24, 2016 edited
  • 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!"
@floam
Member
floam commented Jul 24, 2016

This is #1401.

It looks like the fix for it in e1f623f is no longer present.

@floam floam added this to the next-2.x milestone Jul 24, 2016
@floam floam self-assigned this Jul 24, 2016
@floam floam closed this in 3d0ea5f Jul 24, 2016
@floam floam added a commit that referenced this issue Jul 24, 2016
@floam floam Only show fish greeting for interactive logins
This is a regression introduced by 834ebef
Bolster with a check for only login sessions too -- hopefully makes it
less annooying on subshells in general.

Fixes #3261
3a7a6f1
@terrycloth

Wow, that was fast. Thanks!

@ridiculousfish
Member

This got reverted as 88688d0

@ridiculousfish
Member
ridiculousfish commented Jul 24, 2016 edited

There was some thrashing here. I reverted all the way back to d252704

Looks like it was a little too fast :)

@floam
Member
floam commented Jul 25, 2016 edited

Aye ye ye: more like "trashing":.. I literally thought origin on that Windows machine I was using git on (without fish handy) was my remote but it was fish-shell (I normally make it
'upstream').

I was trying to essentially stash the commit log and break __fish_config_interactive such that I wouldn't forget about actually testing that one with fish available when I got home. I even pushed a second time when it didn't seem to take. I didn't realize for a while that it was actually to fish-shell/master. I'm sorry!

@ridiculousfish
Member

Ah, that makes sense. No harm done.

@floam floam added a commit that closed this issue Jul 31, 2016
@floam floam Only do fish_greeting if interactive
Even if __fish_config_interactive, it can be shown when a script
uses `read`.

Fixes #3261, #1401.
b77e2a6
@floam floam closed this in b77e2a6 Jul 31, 2016
@krader1961 krader1961 modified the milestone: fish 2.4.0, next-2.x Sep 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment