Hacker News new | ask | show | jobs
by SAI_Peregrinus 1940 days ago
I think Fish is an excellent interactive shell. I've still got Bash as my default shell for non-interactive sessions, but I configured Konsole to start Fish by default for interactive use (Settings->Command, set to the path to the fish executable). That way scripts that need Bash still work, but I get a sane environment for interaction. For "portable" scripts I write POSIX shell, C, or Python, depending on what I need to be portable to.

fish_add_path will solve one of the few annoying things about Fish.

I've been looking at trying Oil as a Bash replacement though, I think Oil for scripting + Fish for interaction might be a best-of-both-worlds setup.

3 comments

Shebangs direct scripts to the right interpreter. Setting a default interactive shell won’t override it.
True, but there do exist (crappy) scrips with incorrect shebangs. EG specifying `#!/bin/sh` when they should use `#!/usr/bin/env bash`, since `/bin/sh` isn't necessarily bash. Could be dash. Could be fish. Could be oil. Etc.)
I think /bin/sh is required to be a POSIX shell, at least when invoked with that name, and fish wouldn’t qualify.
Fwiw fish_add_path doesn’t fundamentally change anything, users do get confused between global and universal variables and how they interact with exported variables like PATH, so this just makes it friendlier.
It also helps prevent duplicate path entries. I'd written an "add_to_path_if_not_present" function, but "fish_add_path" should do the same thing. It's just convenience, but Fish is largely about convenience.
Thanks for sharing. I have a debian box that I try keep as standard as possible, and I think this setup would fit my environment well.