r/linux • u/oilshell • Jun 17 '19
AMA: I spent 3 years creating a new bash-compatible shell called Oil
Here are a couple posts that may spawn some further questions.
FAQ, 2019 Edition - I wrote this yesterday for the AMA
Why Create a New Unix Shell? (2018)
Questions could be about: technical issues when writing a shell, why I'm creating a new shell, surprising things I learned about shells, related Unix tools, programming style, etc.
I'm looking for people to try the shell and give feedback! It takes about 30 seconds to install.
231
Upvotes
45
u/isforinsects Jun 17 '19
What is the most limiting historical holdover that you've had to deal with?
20
u/WickedFlick Jun 17 '19
How does Oil compare to Fish? Does it have similar QoL features like improved auto-complete and highlighting?
20
u/GrouchyAlternative4 Jun 17 '19
Hi Oilshell,
I've been watching your shell project with interest for some time now. I now believe that Linux could benefit immensely with an improved shell, most importantly which is object oriented and more easily programmable.
To that end, my questions
9
u/givemeoldredditpleas Jun 17 '19
I've read about your ongoing effort multiple times, so I took the AMA as an opportunity for a quick setup. I apologize for the crudeness of a first try, looking primarily at the user experience, not yet at the hard language features of your shell.
Reading the INSTALL certainly helps, to have libedit headers and configure --with-libedit to tap the muscle memory.
I looked for support of ANSI escape color sequence support, but couldn't find specifics with a quick grep -r, or see them mentioned in the quickref, I'm sorry if I missed something.
9
u/kirbyfan64sos Jun 18 '19
So I will admit I love the idea of a new shell that's posix-compatible unlike fish and xonsh, but I have two questions:
23
u/wwolfvn Jun 17 '19
Hi, thank you for your contribution. I wonder why you chose Python over C++ for Oil?
21
u/isforinsects Jun 17 '19
What have you found is the most requested feature in a new, backwards compatible shell?
7
u/isforinsects Jun 17 '19
You mention not implementing job control in oil because you use tmux. Do you see this changing once you have a better handle on signals?
3
u/_W0z Jun 18 '19
Anyway I can help out on this project?
3
u/funbike Jun 18 '19
I love to see this kind of project, although I am not sure if it fits me. I use zsh interactively and bash for scripts.
I'd like to have a shell for scripts that encouraged cleaner, better, safer scripts, with some minimal backward compatibility.
set -euo pipefail; export IFS=$'\n\t', by default (or equivalent)I've achieved much of the above with a library that I carry abound.
2
u/Sigg3net Jun 19 '19
This actually looks awesome. A lot of my job is centered on bash scripting. My latest BASH project was 2.8K LOC (though that includes documentation).
Will definitely be trying this out.
2
u/itaranto Jun 19 '19
This is really cool, although I dislike the usage of Python for this.
Don't take this as an offense, I just think that a shell should be made the most efficiently possible.
But, never mind me. I'm going to take a look at this.
2
u/aoeudhtns Jun 20 '19
One thing I wish we could modernize is the reliance on character or bytestream pipes. Not sure at what level that is done - POSIX standard, libc, or the shell itself. But the basic idea would be, in addition to STDIN, STDOUT, and STDERR, have what I like to call STDSTRUCT. There'd have to be some sort of handshake - first, assuming one could probe to see if the feature is supported, then there'd be an exchange akin to an HTTP Accept, where the receiver pipe could state how he wants data, and the sender then picks a supported format amongst the supplied list. (Can always fall back to sending human output on STDOUT if negotiation fails.)
And then we no longer need to parse brittle human-readable text output in scripts.
lscould output like this for a person:But if the pipe negotiated a STDSTRUCT exchange, say,
text/json, it would just output:Of course this would be great with CBOR, MessagePack, BSON, etc. (And I would insist on the handshake pattern rather than forcing one particular format, like JSON or YAML.)
Shells like oil could take advantage of STDSTRUCT to do potentially really nice scripting features, like field resolution (pseudo):
(Yes I know we can do this particular example easily/safely with
find, and as such it isn't representative - but I hope it conveys the idea.)4
u/theTaffingSpiralKing Jun 17 '19
Do you have plans to switch to Python 3?
2
u/[deleted] Jun 17 '19
why not using github/gitlab for more attention?
4
u/smirkybg Jun 18 '19
Funny how searching for "Oil shell" in google gives you Shell Oil Gas Station results :D
If you beat that conflict, then you certainly won.
7
u/LordAlbertson Jun 17 '19
Kudos to you for working on this and answering questions, also for being open about the project for feedback and criticism.
1
u/TiredOfArguments Jun 18 '19
Nice project!
Small concern about the choice of language, not that is python bit that it is version 2 of python not version 3.
How will the EOL for python 2 next year impact the project?
1
u/[deleted] Jun 18 '19
I looked around on the site, but I'm having a hard time finding some examples of what Oil (not OSH) looks like. Do you have some examples somewhere of your proposed design?
1
u/Serious_Feedback Jun 20 '19
What advantages are there for people who barely use the terminal, apart from "other people are more productive"-type advantages?
1
u/wertercatt Jun 22 '19
Is osh developed enough to fully rely upon as a bash-compliant replacement in a system? (ie: symlinking /bin/bash to osh)
1
u/Refaimufeer Jun 30 '19
I have Zero knowledge about this, somehow today I have installed Linux lite in my old Windows 8 pro and finding it very interesting. However my question is is it for the PC or mobile base? How do I really understand which is for which!
3
u/jtgyk Jun 21 '19
I don't understand a good deal of this, except the fly over view, but it sounds like a really interesting project and I hope it takes off.
1
u/kazi1 Jun 17 '19
Why are you still using Python 2 when it's been officially deprecated?
2
u/Taenk Jun 19 '19
An extremely ambitious project, I am intrigued! The feature that sets oil shell apart is the intention to remain bash/posix compatible, meaning that existing projects continue to work, while at the same time introducing a more expressive language for the shell.
In addition to the other really strong suggestions I’d like to propose a rather weak one: Have some programs work as libraries and vice versa and an easy way for developers to write programs such that they follow that duality. What I mean is that you could for example call youtube-dl in the shell manually like YouTube-dl “https:…” and in a script as try: YouTube-dl(“https:…”) except: or similar fashion.
Either way, I am going to follow development closely.
2
u/Bobjohndud Jun 29 '19
AUR?
1
u/JL2210 Jun 23 '19
What was the main reason you decided to use Python? Does it increase portability? How are OSX builds done?
1
u/gbayl Jun 19 '19 edited Jun 27 '19
I admire your ambition and dedication, but I am somewhat confused as to the efficacy of this endeavour.
The other shells fail to make traction due to legacy and for this reason you seek backwards compatibility. This solves one problem but creates another, there is no motive to migrate from bash, instead it opens up possibility of mixed language scripting which is a far more concerning issue than than there was before (if this is allowed).
Ultimately, the true solution is a modern shell released in concert with a utility program to translate bash (or other scripts) into the new language. Furthermore that new shell really should be written in C/C++ or even Rust.
I do not wish to decry your efforts, the creative methods you have employed are extraordinary. I'm just concerned that the approach is overly complex and although initially attractive, somewhat misses the obvious alternative which is to keep using bash. Bash 5.0 is about to be released, how does this affect your project?
1
u/Aoxxt2 Jun 24 '19
Why the dreaded MIT license instead of GPL(2/3)? I only would only move away from BASH if the shell I am moving to is GPL as well.
0
u/[deleted] Jun 23 '19
USA wants to know your Location
0
u/[deleted] Jun 24 '19
I tried to scan through the latest FAQ to find a quick and short to the point as to WHY? Maybe I need to look longer and harder but I did not find it quickly and that's a big issue for me. The website itself has no useful info on it at all, it should present that and more info, instead it points to a long ass FAQ and that long ass FAQ points to other older even more long ass FAQ. Yes call me lazy but I know how I how people attention spans are, mine is better usually but in this day and age the average persons is actually WAY worse then mine.
So this is just a programming experiment to do something in less code? Why Bash not ZSH? I am not a mac user and I never will be but I think they will twitch to it as default shell and I get why. Because its just better, I started using it some time ago, I think its the default shell in Arch Linux already. I uses it together with oh-my-zsh so I actually not know what features are zsh only because they implement some nice convenience as well. Its boils down to how history and completion tabbing is handled, its just a million times better then in bash. Whenever I am on server with bash I freak out and want zsh.
As a user I do not care about how much lines of code you saved but what actual benefit I as a user get, did not find any my quickly scrolling thorough the FAQ.
I would love to hear someone to rewrite a ZSH compatible Shell in Rust. I am not a programmer in those low level languages but I know enough to know the memory save Rust language is awesome and 1000 times more secure that stupid python with this crappy pip package manager that has not even package signing on by default (nobody uses it even though its there).
So sorry you failed to peak my interest. All you had to do is some basic sentence where you get to the point and explain WHY and BENEFITS.
I guess I am gonna get killed now for my rant that took more time to write then actually reading the FAQs - silly me.
-1
u/nostril_extension Jun 19 '19
I feel that Oil really isn't going far enough here. Have you heard of Xonsh?
I've been using xonsh as a daily driver for over a year now and I think that's exactly how the new shell should be done - take advantage of one of the most popular general-purpose and scripting languages in the world.
To me it seems that xonsh answers this much better:
I think anyone in their right mind would chose python for "hundreds or even thoyusands of lines" long scripts.
I also disagree with the entire paragraph of this FAQ. Shell code is the most replacable code out there - you could probably get rid of your shell scripts in an evening, assuming of course that you can read them.
Pretty much lost any sort of credibility here without further expanding on this.
To me it seems like Oil is this weird conservative take on innovation which, I'm sorry to say, is just not very interesting. I think the medium is well past conservative iterations and much more keen on revolutions.
0
u/[deleted] Jun 17 '19
[deleted] — view deleted comment
0
u/[deleted] Jun 18 '19
[deleted] — view deleted comment
0
u/[deleted] Jun 24 '19
[deleted] — view deleted comment
0
u/[deleted] Jun 28 '19
[deleted] — view deleted comment
0
u/[deleted] Jun 17 '19
[deleted] — view deleted comment