2

I've added a command to start fish terminal from bashrc and so far it was working ok. I've just added this line at the end of bashrc

fish

But after I quit fish to default shell current input isn't displayed anymore, although pressing enter will interpret whatever was typed. Is there any other way to start fish automatically without affecting standard input stream?

2
  • Show us how you start fish from your ~/.bashrc file. By "terminal", I presume you mean "shell".
    – Kusalananda
    Commented Oct 31, 2019 at 0:19
  • Yes, by terminal I mean shell. Updated the post.
    – Johnny_D
    Commented Oct 31, 2019 at 0:24

2 Answers 2

1

When you exit the fish shell session, the bash shell that was starting up but that was "put on hold" while fish was running, continues to run. For whatever reason, it leaves the terminal in a confused state (try reset or stty sane to fix that).

If you always want to run the fish shell instead of bash, then it would be easier to just change your login shell to fish. You do this with the chsh command on most Unices.

If that's not possible, then rather than just running fish from you ~/.bashrc file, use exec fish from somewhere in the beginning the file. This would replace any interactive bash shell session with a fish shell session, and when you exit the fish session, you would not be left in a bash session.

2
  • Adding anything to bash_profile doesn't change anything for me, moreover this file wasn't even existing before.
    – Johnny_D
    Commented Nov 5, 2019 at 22:48
  • @Johnny_D You mean ~/.bash_profile? Well then you terminal might not be starting a login shell for you. The ~/.bashrc file might in that case be the correct file after all. I've updated the answer.
    – Kusalananda
    Commented Nov 5, 2019 at 22:50
1

You can run stty sane or reset to get your terminal back to how you expect.

Rather than running from the bottom of .bashrc, you can configure your terminal to start fish instead of your login shell.

2
  • I see, but unfortunately I have to use bash from time to time as some script aren't working in fish.
    – Johnny_D
    Commented Nov 5, 2019 at 22:43
  • @Johnny_D Note that whatever language that you use to write scripts in does not in any way need to be related to what your login shell is. Just like you can write and run Python script while using the fish shell as login shell, you can write and run bash scripts while using the fish shell as your login shell.
    – Kusalananda
    Commented Nov 5, 2019 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .