News for hackers. Stuff that matters.
Re:The fish shell is amazing by jscheel on Thursday November 25, 2021 @11:12AM (#29342486)
This is my problem as well. I’ve been using fish for quite a long time, and I’m still frustrated by weird posix incompatibility.
Re:The fish shell is amazing by dangus on Thursday November 25, 2021 @11:18AM (#29342542)
bass can be helpful for some of those posix issues:

https://github.com/edc/bass

Another random tip: python virtualenv generates a activate.fish script that you should use instead of the plain activate script.

Re:The fish shell is amazing by emptysongglass on Thursday November 25, 2021 @11:43AM (#29342750)
Bass has never worked for me, in any scenario. I'm curious to see how you use it. I have never successfully been able to feed it any bash script. At this point I suspect I'm either holding it wrong or it is a thing that is invoked as a thing that works without ever being used in earnest.
Re:The fish shell is amazing by dangus on Thursday November 25, 2021 @12:00PM (#29342923)
If your bash script has a shebang you shouldn’t need bass at all. Fish will read the shebang and just run your script with bash.

The only thing I ever used bass for was this edge case where at work the way we login to AWS is using this Okta AWS integration that prints out a list of export commands.

Since fish isn’t compatible with bash export commands, I just run that command result through bass, which automatically converts them to the fish set -x commands.

If I remember right, I think the reason why the bash script my company made didn’t work is that the export commands that were run in bash weren’t propagated to the underlying fish environment. I was using fish to run a script with a separate shell, so it didn’t affect my environment variables.

Or maybe it was because running exec inside a bash script throws you back into fish which then can’t understand the export command.

I could have definitely done my own thing with sed/awk instead, but I suck at those tools and someone else already implemented the functionality in bass.

    bass exec aws_okta_thing_that_prints_export_commands_to_stdout
(Off the top of my head, I think it was something like that, could be misremembering! And by this comment you might be able to tell that I’m far from an expert on how everything works.)
Re:The fish shell is amazing by pxc on Thursday November 25, 2021 @12:22PM (#29343144)
> If your bash script has a shebang you shouldn’t need bass at all. Fish will read the shebang and just run your script with bash.

Shebangs are actually handled by the operating system kernel! I only know this because certain kinds of shebangs work on Linux, but not on other OSes

Re:The fish shell is amazing by dangus on Friday November 26, 2021 @07:38PM (#29355915)
That’s pretty neat information! I honestly barely know how all the pieces come together.
Re:The fish shell is amazing by pxc on Saturday November 27, 2021 @05:39PM (#29364307)
I was kind of hoping my comment would bait some OS person lurking on HN into really explaining interpreter directives, hahaha
Re:The fish shell is amazing by Macha on Thursday November 25, 2021 @11:58AM (#29342903)
bass works for things you're meant to source. If the script is not meant to be sourced, just run bash yourscript.sh .

It basically runs the script in bash, diffs the environment, and applies the environment changes to your outer fish shell. I use it for some internal tools, and previously used it for nvm though I moved from nvm to fnm now which has fish support.

Re:The fish shell is amazing by yourad_io on Thursday November 25, 2021 @05:48PM (#29345740)
Hadn't heard of fnm before, thanks. Seems worth checking out.
Re:The fish shell is amazing by lovelyviking on Thursday November 25, 2021 @11:55AM (#29342874)
>I’m still frustrated by weird posix incompatibility.

Can you also share what are the most significant problems with posix incompatibility for you? Why is it a problem?

Re:The fish shell is amazing by mey on Thursday November 25, 2021 @03:05PM (#29344529)
The one I see is really, all of Linux vs OSX/MacOS. And which version of Bash is shipped by default.

Internally we have a boot strap run book developers/operations to bring up either Windows/WSL or MacOS to a consistent shell env.

Re:The fish shell is amazing by preseinger on Thursday November 25, 2021 @07:12PM (#29346302)
This shouldn't be an issue! Shell scripts begin with e.g.

    #!/usr/bin/env bash
which means the interactive environment is irrelevant. Users of nonstandard shells like fish need to learn a bit of on-the-fly translation if they expect to copy/paste into their terminals, but it isn't too onerous.
Re:The fish shell is amazing by mey on Thursday November 25, 2021 @07:22PM (#29346366)
Not going to ping my coworker that deals with this (Happy Thanksgiving), but the version shipped with OSX was several versions behind Linux.
Re:The fish shell is amazing by BigJ1211 on Friday November 26, 2021 @04:26AM (#29348673)
I just checked it on my Mac and my Ubuntu server.

MacOS has version 3.2.57(1) Ubuntu has version 5.0.17(1)

Apparently Apple cites license concerns as the reason for not upgrading it. Don't know how valid that is.

License on version 3.2.57 is GPLv2 License on version 5.0.17 is GPLv3+

It's simple enough to update if you use homebrew.

`brew install bash`

Add the brew version of bash to the /private/etc/shells and change the shell.

Re:The fish shell is amazing by mey on Friday November 26, 2021 @01:40PM (#29352792)
That's basically one of the developer setup steps, in addition to running through installing things like jq and yq. Point is, it was a significant enough of a delta (easily fixed) that we ran into compatibility issues with the scripts we wrote.
Re:The fish shell is amazing by jscheel on Sunday November 28, 2021 @08:42PM (#29375343)
Honestly, I think it’s just fighting years of muscle-memory more than anything. Not necessarily a valid complaint, I know.