Monday, April 18, 2011

Linux: Fish Hanging

fish is a "user friendly command line shell for UNIX-like operating systems such as Linux." I've been using fish for about a year, and I really like it. Unfortunately, until recently, I had a problem that I couldn't log into virtual consoles in Linux. If I hit Cntl-Alt-F1 and tried to log in, fish would just hang. This was mentioned on the mailing list a long time ago. I'm pleased to say that I finally solved the problem.

I had the following code in my ~/.config/fish/config.fish:
type fortune > /dev/null
and begin
fortune
echo
end
Basically, this code says, "If fortune exists, run it. Otherwise, don't complain." I figured out through a process of elimination that was the culprit. I replaced it with:
if status --is-interactive
fortune
echo
end
This code will result in an error if fortune doesn't exist, but it won't die. It turns out to be fine for me since I only run fish on my laptop, and I usually install fortune at the same time I install fish.

No comments: