O
Oils Blog
oilshell.org · Company blog · on HN since 2016
Andy Chu writes about Oils (Oil Shell), a project to build a better Unix shell language and a path off bash.
What HN saysHN commenters bring it up as a candidate replacement for bash and shell scripting pain, with the author linking it to explain his motivation.
156HN people shared it
105linked it in comments
210stories submitted
4.0Kstory points
4 months agolast shared
2016people per year2026
Most-shared posts
- 1Oil Shell: Our upgrade path from bash to a better language and runtime44 people · 14 points · first shared 2016 · discussion on HN
- 2Why Create a New Unix Shell?11 people · 73 points · first shared 2021 · 62 comments on HN
- 3Why Create a New Unix Shell?9 people · 411 points · first shared 2018 · 292 comments on HN
- 4Shell Has a Forth-Like Quality9 people · 214 points · first shared 2017 · 114 comments on HN
- 5Blog9 people · first shared 2016
- 6A Sketch of the Biggest Idea in Software Architecture (2022)8 people · 267 points · first shared 2022 · 67 comments on HN
- 7The internet was designed with a narrow waist8 people · 109 points · first shared 2022 · 36 comments on HN
- 8Four features that justify a new Unix shell6 people · 248 points · first shared 2020 · 180 comments on HN
- 9A Tour of the Oil Language5 people · 163 points · first shared 2021 · 42 comments on HN
- 10Shell, Awk, and Make Should Be Combined (2016)5 people · 39 points · first shared 2019 · 9 comments on HN
- 11A Garbage-Collected Heap in C++, Shaped Like Typed Python5 people · 8 points · first shared 2022 · discussion on HN
- 12Pratt parsing and precedence climbing are the same algorithm (2016)5 people · 6 points · first shared 2016 · 1 comments on HN
- 13Shell Pipelines Support Vectorized, Point-Free, and Imperative Style5 people · 5 points · first shared 2017 · discussion on HN
- 14Why Use Oil?5 people · 2 points · first shared 2020 · discussion on HN
- 15Building Oil with the OPy Bytecode Compiler4 people · 35 points · first shared 2018 · 19 comments on HN
What HN people wrote when they linked it
chubot · 2024-12-08
Yes I agree - my favorite language is Python, but it can be annoying/inefficient for certain low-level OS things. This is why I created https://www.oilshell.org (and the linked wiki page)
A few links for context:
Are you reinventing Perl?
https://www.oilshell.org/blog/2021/01/why-a-new-shell.html#are-you-rei…
The Unix Shell Should Evolve Like Perl 5 (with compatible upgrade options, rather than a big bang like Perl 6/Raku)
https://www.oilshell.org/blog/2020/07/blog-roadmap.html#the-unix-shell…
A Tour of YSH - https://www.oilshell.org/release/latest/doc/ysh-tour.html
dmckeon · 2024-11-01
Might have been Oil shell, which is worth looking at: https://www.oilshell.org/
xiaq · 2024-05-10
While I don't agree with most of your analysis - in particular for the second example, I'd invite you to read its explainer that goes into much more depth (https://elv.sh/learn/scripting-case-studies.html#update-servers-in-par… - I think you might be more interested in the Oil Shell project, which is trying to chart a smooth upgrade path from bash: https://www.oilshell.org
I think we simply can't say for sure which path is better for the future of shells, and I'm quite excited by the fact that different projects are exploring different directions. I will just stick to the path I find best and won't try to convert you :)
__float · 2023-09-12
> I know how and love to write in bash. But oh god was it painful to learn
This is very well said :)
> Sad that there's nothing established to take its place (Perl is read-only, python is not good enough as unix glue, everything else is too obscure).
Is there anything notable? Either particularly well designed, or just popular? I think I've only ever heard of Oil (https://oilshell.org)
teleforce · 2021-12-07
Shell script is a kind of DSL for the OS operations and PHP a kind of DSL for the web programming. Similarly, it does not make sense to advocate the usage of R for web programming but people do it anyway.
Shell script have their deficiencies but it's the best for their intended environment. Alternatively now there's Oil shell that looks promising for modern approach to shell programming [1]. Expect to see exponential usages of shell programming now that we have new popular OS related technology including containers, isolates, and functional package management like Nix and Guix.
[1]https://www.oilshell.org/
hnlmorg · 2021-02-27
Author here:
Agreed. This is one of my biggest regrets for not following POSIX syntax more closely. So much so that I did at one point start writing in support for inlining Bash (and others) code into murex as a way of allowing users to make use of the rich content already out there. But I couldn't decide on a clean way of implementing it that wasn't any better than `bash -c 'some code'` so ended up removing the feature.
As it is, I'm still half tempted to incorporate a bit more POSIX support to make code sharing easier. But there's a real risk that I could compromise the design goals of my own language in doing so.
I think this is projects like Oil Shell (https://www.oilshell.org/) have the upper hand. It's gone for Bash compatibility plus new features. I have a lot of respect for what they do as it's a much harder undertaking than what I've done.
aidenn0 · 2020-02-01
Shellcheck is amazingly impressive at catching issues with shell scripts. It makes it very hard to write a shell script that does the wrong thing.
Also, look at oilshell[1]; it is bash compatible out-of-the-box, but has several options to make it incompatible, but safer (e.g. no field splitting of parameter expansion by default, making quotes much less needed).
1: https://www.oilshell.org/
yumaikas · 2017-10-11
ilyash, I think you should see if http://www.oilshell.org/ might be worth your time. (not the author, but I respect it's goals)
j1elo · 2021-06-16
Thinking this is so cool! I was wondering if seriously buying into an alternate shell like this would be worth it in the long run.
Would really love to read from people who use(d) an alternative shell, both success and failure stories.
I cannot shake from my head the idea that buying into a non-standard shell will only work for personal projects in one's own workstation, but it won't fly too far for company work because you'd then be introducing an implicit dependency on your special snowflake non-standard runtime. Which is something we came to accept and assume for interpreted languages (Python, Ruby, Node, etc.) but I'm not yet ready to assume for shell scripts.
So right when I was going to test Nushell, I discover there are also other shells like Elvish [0] and Oil which supports structured data [1]. Now on top of my hesitations I'm adding decision paralysis :-]
[0]: https://elv.sh/
[1]: https://www.oilshell.org/
Lots more shells: https://github.com/oilshell/oil/wiki/Alternative-Shells
oblio · 2018-05-24
> However, I've never believed it to be possible to have a language both as a shell language and a proper programming language for large-scale projects. I believe the two usecases are fundamentally antithetical, but I'd be happy to be proven wrong.
I'd say Powershell proves you right. Powershell has a great design, it has optional typing and access to a cornucopia of libraries via .NET.
Even so, they had to make some compromises because of the shell parts (functions return output, for example) which makes is quite finicky as a "proper" programming language.
On the shell side, the very nice nomenclature which makes it very readable and discoverable makes is annoying sometimes to use as a shell. That and the somewhat unwieldy launch of non-Powershell commands.
Someone who attempts to bridge the two has a ton of work to do, both in the research and in the implementation department. I guess Oil Shell (https://www.oilshell.org/) is the most realistic approach we have today. And it's probably still 1-2 years away from release and many more years from mass adoption (if that ever happens).
nly · 2024-10-29
Oil shell?
https://www.oilshell.org/
Compatible with most bash scripts
viraptor · 2024-09-11
Switching away from being bash compatible would be really unexpected. Too many existing scripts and websites explaining how to do things. Maybe something like http://www.oilshell.org/ has a chance though?
If we were breaking away from the old style shells completely, then https://www.nushell.sh/ would be my preferred upgrade.
bazzargh · 2024-09-09
bash and readline - Chet Ramey. Both originally by Brian Fox https://twobithistory.org/2019/08/22/readline.html
maybe less of a bus factor now with OSH approaching feature/speed parity and having more maintainers https://www.oilshell.org/
Taikonerd · 2024-06-13
Oils is a different approach to this - the base “OSH” language is pretty much identical to bash, and then you can incrementally opt in to more checks and QOL improvements.
The key selling point is that you never have to totally rewrite your existing bash scripts - there’s an incremental upgrade path.
https://www.oilshell.org/
klibertp · 2024-05-22
Rash (https://rash-lang.org/) and Oil (https://www.oilshell.org/release/latest/doc/ysh-tour.html) come to mind. Xonsh, too, as mentioned. Powershell too.
Most high-level languages have packages that implement DSLs for running and connecting subprocesses. Python has both `subprocess` in stdlib and things like plumbum (https://plumbum.readthedocs.io/en/latest/index.html) or fabric as 3rd party packages. Scala has a little DSL ("echo 1" #| "cat" !) for this in stdlib. How lightweight the syntax is depends on how DSL-friendly the language is, so things like Ruby or Raku might be your best bets.
LectronPusher · 2024-05-22
I haven't seen a mention of the Oil Shell (https://oilshell.org) project's OSH/YSH yet and I'm quite surprised.
Oils goal is that OSH is just a new Bash implementation (although not bug-for-bug) but with an upgrade-path to the more modern YSH for real programming with type safety etc, but still as a shell language. One of their exciting ideas is using code as data in a somewhat lisp-like manner to allow function introspection in YSH etc.
Based on other comments it seems like Oil Shell is much more principled in working to actually understand Bash as it exists and presenting an alternative language. I would be interested in what differentiates Amber and whether they have a response to Oils?
skybrian · 2024-01-21
I guess this is too new for there to be any language documentation yet? Or perhaps I missed it.
I'm wondering if it's picked up any ideas from oil shell [1].
[1] https://www.oilshell.org/
maleldil · 2023-12-28
This resembles OSH/YSH, especially the v1/v2 layer things.
http://www.oilshell.org/
KingMob · 2023-08-31
You may be interested in https://www.oilshell.org/. It has many of the same end goals as nushell with more of an upgrade path from bash planned. You can start with full compatibility, and then turn on shell opts as you get comfortable to enable new behavior and disable bad old practices.
diegocg · 2023-06-20
Or just use a sane shell (eg. the oil shell https://www.oilshell.org/blog/2020/10/osh-features.html#eliminate-quot… fish) where handling pathnames with spaces, etc. is not a problem and doesn't require arcane quoting knowledge or linters.
The only reason why this is an issue is that people insists in using bash in the name of backwards compatibility. It's about time people start considering moving away from bash - its design is broken and the efforts and time it takes to write safe bash shells might not be worth it.
_dain_ · 2023-03-11
The oil shell is an attempt to move forward:
https://www.oilshell.org/
nextaccountic · 2022-11-01
I would recommend Oil!
http://www.oilshell.org/release/latest/doc/idioms.html
It removes the need to quote every variable, and this is fantastic
abecedarius · 2022-08-25
Good prompt for a beautiful matcher with better complexity. Have a favorite?
https://www.oilshell.org/archive/Thompson-1968.pdf is longer and doesn't quite fix the problem (see third-to-last paragraph) but it is interesting and very tight.
d0mine · 2022-03-25
bash is anti-bicycle: no matter how long you use, it trips you up. https://www.oilshell.org/why.html
Shell is great for one liners to run commands, cancerous for anything more complex. Fabric combines the best of both worlds: shell for one liners, Python for more complex logic https://docs.fabfile.org/en/2.6/getting-started.html#addendum-the-fab-…
m3at · 2021-10-31
I agree with your broader point that we seem stuck with old shells and no contenders seems in a position to replace them. However some are certainly trying, like osh [1] that takes backwards compatibility with bash seriously, which makes adoption easier.
Maybe it'll be like the C++ vs Rust situation?
https://www.oilshell.org/
frazbin · 2021-09-15
Super duper excited about this and have been for the past five years. Awesome to see things coming together.. good things take time! This guy is singlehandledly trying to elevate shell, revealing its secret beauty and immense power. My favorite thing is his obsession with bash backwards compatibility-- it has led him to get super deep into the bash parser. Unrelated but useful by the same person: Bernstein chaining of ssh and su: https://www.oilshell.org/blog/2017/01/31.html
minhmeoke · 2021-08-21
Turtle [1] is a reimplementation of the Unix command line environment in Haskell that permits you to run external shell commands but leverages the typesystem to provide structured values and reduce errors.
Turtle> cd "/tmp"
Turtle> pwd
FilePath "/tmp"
Turtle> :type pwd
pwd :: IO Turtle.FilePath
Turtle> touch "file"
Turtle> testfile "file"
True
Turtle> rm "file"
Turtle> testfile "file"
False
Fish [2] and Oilshell [3] are two other efforts to create new shell dialects that improve usability while remaining somewhat backwards-compatible.
[1] https://hackage.haskell.org/package/turtle
https://hackage.haskell.org/package/turtle-1.5.22/docs/Turtle-Tutorial…
[2] https://fishshell.com
[3] https://www.oilshell.org/
macintux · 2021-05-06
Not quite what you asked for, but the creator of oilshell is often here and has given quite a bit of thought to what a shell is and why create a new one:
https://www.oilshell.org/
miduil · 2021-03-18
shellcheck won't force you to prefer one of the two variants, hence the difference is relatively subtle to a degree that even documentation is not superhelpful either: https://www.oilshell.org/blog/2016/10/12.html
shellcheck will show you many more mistakes that are much more painful your example and also very common.
Deno is definitively an interesting language, but Shell scripting is the gateway to bootstrap so many of your beloved programming languages. If your environment allows it always prefer a proper programming language over shell scripting. Shell scripts are meant for Unix operating system operations, setting few variables, combining certain data-sources, doing filesystem operations, ...
pcr910303 · 2021-03-01
I used to really use fish pervasively in my computer, but after a while I realized that I forgot literally all of bash (like I forgot how for-loops look like, how word split works…) and I just switched back to macOS default zsh.
I’m still wanting a fish-alike interative shell that improves on the Bourne shell language (and bash extensions). I’m having hopes on Oil shell [0], but it’s still in an early stage so I guess I’ll have to wait for a far future…
[0]: https://oilshell.org