Live data from Hacker News

Why Create a New Unix Shell?

oilshell.org

41–50 of 63 posts

Re: Why Create a New Unix Shell?

#41

Others' experiences may vary but personally speaking I have to write a fair amount of shell scripts that run on a range of machines, networks etc. At best its a pita to change shell on these ephemeral boxes, worst case its out of my control. The lowest common denominator ends up being the good ol' bash (or sh)! Sure fish/oil is nice but quite a bit of mental gymnastics to keep them all straight in my head.

That's reasonable, but Oil can still be useful to you as a dev tool, since it implements a very large and sane subset of bash. Some details here:

http://www.oilshell.org/why.html

And something I just released is a better "set -x", which no other shell has:

https://www.oilshell.org/release/0.8.7/doc/xtrace.html

So you could debug your programs with Oil if bash tracing isn't enough (which it often isn't for me).

Oil is also very easy to build and install -- all you need is a compiler, a shell, and make, and make will probably go away at some point.

Re: Why Create a New Unix Shell?

#42

It's only tangential but switching to fish shell made me about 3 times more productive. Being able to easily recall commands, to have completions displayed as I type, and to have interactivity be a first class citizen of the environment... made working in the shell so so so so much nicer. Fish has its own quirks, some of which seem unnecessary, but it was a godsend. There is definitely still room for improvement of t…

How does fish compare to zsh? I just switched from bash to zsh and am loving it.

Fish is a bit like the Mac of shells. Stuff just works and its easy to use while flexible. Lots of little details are well polished.

The downsides are similar to Mac. Less standard/compatible with other stuff. Zsh seems more like a traditional shell. Meaning it is far more complex. Fish really aims to keep simplicity.

I have used Fish for many years and swear by it but I am also not the kind of guy who writes long shell scripts. I use regular programming languages for that. For me fish is mainly about having a shell that works well in interactive use.

Re: Why Create a New Unix Shell?

#43

It's only tangential but switching to fish shell made me about 3 times more productive. Being able to easily recall commands, to have completions displayed as I type, and to have interactivity be a first class citizen of the environment... made working in the shell so so so so much nicer. Fish has its own quirks, some of which seem unnecessary, but it was a godsend. There is definitely still room for improvement of t…

Interesting, it seems a 3x productivity boost to all programmers and admins would be a no brainer for the industry.

Not everyone who uses a computer is a programmer or an admin. I can't speak to their needs or what fish provides for them.

Re: Why Create a New Unix Shell?

#44
post #32

Sometimes I want a more interactive shell. With the native ability to display graphics and view html and PDFs and other docs, without opening a separate GUI program.

Yeah I hope people will build stuff like that on top of Oil. Hopefully this year the embedding story will become clearer, and progress can be made on top. Some notes here about interactive shell ideas: https://github.com/oilshell/oil/wiki/Interactive-Shell Some people might think Oil is sort of a text-only or retro project ... but it really isn't, it's a SPEED project. I use shell because it's the fastest to get cert…

One thing newbies often ask, is why can't they write a shell script which changes the environment or directory of their running shell. The answer, of course, is that you can't, without sourcing it.

People also ask the same question about Windows, and even DOS before it; there you actually could do it from a batch file, since CMD.EXE/COMMAND.COM effectively sources all batch files, it doesn't run them in a subprocess – but the same issue occurs if you write a program in some other language than batch, it runs in a subprocess and so can't modify CMD.EXE/COMMAND.COM's environment. (People resorted to some tricks though, like having a BATCH1.BAT call their program, and then afterwards call BATCH2.BAT, and their program modifies BATCH2.BAT on disk).

Actually on DOS, there is a way to modify COMMAND.COM's environment – COMMAND.COM installs an undocumented interrupt, INT 0x2E, which you can use to send commands to COMMAND.COM to run. So you can actually modify COMMAND.COM's environment. (Only the root COMAMND.COM installs a handler for INT 0x2E, nested ones do not.) Of course, due to no memory protection, there are also nasty ways of doing this, like modifying COMMAND.COM's memory. (And changing COMMAND.COM directory isn't an issue, since under DOS, the current directory is system-wide, not per-process.)

I was thinking, you could do something like "INT 0x2E" in a Unix shell. Create a Unix domain socket, and the shell listens for commands on it to execute. Put the path to the socket in an environment variable which is inherited by subprocesses, e.g. SHELL_CONTROL. Then, a subprocess can inspect and modify the shell's environment, working directory, functions, aliases, running jobs, etc, by reading/writing the Unix domain socket mentioned in SHELL_CONTROL.

Re: Why Create a New Unix Shell?

#45

It's only tangential but switching to fish shell made me about 3 times more productive. Being able to easily recall commands, to have completions displayed as I type, and to have interactivity be a first class citizen of the environment... made working in the shell so so so so much nicer. Fish has its own quirks, some of which seem unnecessary, but it was a godsend. There is definitely still room for improvement of t…

I am a huge fan of fish. Oil shell seems kind of different in aim from fish. Fish is trying primarily to be a great interactive shell and have code which is easy to understand but not necessarily compact of efficient to write. But for me it doesn’t matter. For longer things I use Julia or Go anyway.

Absolutely, hence "tangential". I was only hoping to lend credence to the idea that reinventing things is a good idea with a parallel example. I'm not the target audience of oil shell but I wish anyone who takes on something like that all the luck.

It has always baffled me the pushback that is given when someone works on projects like these. As if trying to do better isn't worth it.

Re: Why Create a New Unix Shell?

#46
post #19

Earlier quoted context omitted.

What if the language is “shell”-ish? Reading the piece, the idea of shell as a REPL seemed attractive.

For me: No. I feel like powershell tried exactly that and i don't like it. That may be in the end just depend on execution though. But powershell e.g. prints errors that look like stacktraces (it's been a few years i don't remember exactly) with type information. And while that may be desirable to some, when using bash i'm using a UI as a user and not programming and i don't want to read a stacktrace. I want an error…

There is a try/catch/finally mechanism in powershell: https://docs.microsoft.com/en-us/powershell/module/microsoft... However, it is quirky to set up and I don't remember the details now, it doesn't handle the errors out of the box for sure. I would still prefer powershell over bash (or god forbid, cmd) any day.

Re: Why Create a New Unix Shell?

#47
post #19

Earlier quoted context omitted.

What if the language is “shell”-ish? Reading the piece, the idea of shell as a REPL seemed attractive.

For me: No. I feel like powershell tried exactly that and i don't like it. That may be in the end just depend on execution though. But powershell e.g. prints errors that look like stacktraces (it's been a few years i don't remember exactly) with type information. And while that may be desirable to some, when using bash i'm using a UI as a user and not programming and i don't want to read a stacktrace. I want an error…

Sure. Is that how all REPLs behave? I have a feeling there is a lot of latitude for tuning the ergonomics.

Re: Why Create a New Unix Shell?

#48
post #18

Earlier quoted context omitted.

It always surprises me that people get so much productivity gain out of their editors, shells and keyboards and such. I write maybe a few dozen lines of code on a good day.

(Fish doesn't make me 3x more productive, but...) I think a good analogy would be having sharp tools. If you don't have to exert yourself to do simple things, then menial tasks use less mental energy which you can save for your actual work. Fish manages to pull this off without _any_ configuration burden (I use it completely stock), which is exciting because usually to benefit from shortcuts or macros or other "produ…

their take on config is unique:

> Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failure of both the program and the programmer who implemented it.

https://fishshell.com/docs/current/design.html#configurabili...

Re: Why Create a New Unix Shell?

#49
post #18

It's only tangential but switching to fish shell made me about 3 times more productive. Being able to easily recall commands, to have completions displayed as I type, and to have interactivity be a first class citizen of the environment... made working in the shell so so so so much nicer. Fish has its own quirks, some of which seem unnecessary, but it was a godsend. There is definitely still room for improvement of t…

It always surprises me that people get so much productivity gain out of their editors, shells and keyboards and such. I write maybe a few dozen lines of code on a good day.

I am curious what you are doing with the rest of the day? Planning? Meetings?

Re: Why Create a New Unix Shell?

#50
post #18

Earlier quoted context omitted.

It always surprises me that people get so much productivity gain out of their editors, shells and keyboards and such. I write maybe a few dozen lines of code on a good day.

I am curious what you are doing with the rest of the day? Planning? Meetings?

In my experience, reading code.
Post reply on HN