I want to set fish_greeting to date --rfc-2822 | cowsay -f tux | lolcat (don't judge me). When I run date --rfc-2822 | cowsay -f tux | lolcat interactively, I get the proper output (the date in a speech bubble above tux in rainbow colors). However, when I set fish_greeting date --rfc-2822 | cowsay -f tux | lolcat, I get this output:

 _ 
<   >
 - 
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/

date --rfc-2822

(in color, of course). Why isn't the first pipe working?

  • I don't know what fish is, but have you tried putting the complete path to date in the command? It looks like it's just echoing out the command instead of executing it – djsmiley2k May 1 '16 at 18:40
  • @djsmiley2k fishshell.com. I tried /usr/bin/date, but that give the same output, but with /usr/bin/date at the bottom instead. – ZuluDeltaNiner May 1 '16 at 18:44
  • Weird, I just had a quick play with cowsay (I'm not going to install fishshell atm because no time) but got it 'working' with cowsay $(/bin/date) – djsmiley2k May 1 '16 at 18:47
  • @djsmiley2k In fish the equivalent is cowsay (*command*) (this works). However, I think the problem is that the first command is being echoed, not executed, because the new output is cowsay -f tux Sun, 01 May 2016 11:55:07 -0700 – ZuluDeltaNiner May 1 '16 at 18:56
up vote 2 down vote accepted

fish_greeting can be a function

function fish_greeting; date --rfc-2822 | cowsay -f tux | lolcat; end
  • Clarification: fish_greeting can be a literal string or a function. It has to be a function if you're doing things like executing a statement that includes pipes (or any external command for that matter). See __fish_config_interactive.fish. – Kurtis Rader Jun 22 '16 at 4:48

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.