TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why Create a New Unix Shell?

408 pointsby shadelessover 7 years ago

35 comments

ComputerGuruover 7 years ago
Lots of overlap in design goals with fish, except fish also places a premium on users interactively using the shell (which means friendlier in-repl experience but a balancing act when it comes to features). Fish’ auto completions are incredible, too.<p>Best of luck to them. Another interesting shell to check out is elvish, lots of new ideas there (even if awkward to use).<p>(Disclosure: I’m one of the core fish devs&#x2F;maintainers. Edit: The entire team is awesome and the others deserve virtually all the credit!)
评论 #16277486 未加载
评论 #16277863 未加载
评论 #16278247 未加载
评论 #16279705 未加载
评论 #16277387 未加载
评论 #16277661 未加载
评论 #16277481 未加载
评论 #16277324 未加载
评论 #16278996 未加载
评论 #16277871 未加载
评论 #16279599 未加载
评论 #16281941 未加载
评论 #16277528 未加载
jhillyerdover 7 years ago
After using fish for 3 years, I&#x27;m finding there is very little reason to have my login shell maintain backwards compatibility with bash.<p>The only time I run into issues is when a command expects manipulate environment variables via bash syntax.<p>I think the fish documentation WRT to scripting could be much better, but the language is more elegant than bash or PowerShell IMHO.
评论 #16278087 未加载
评论 #16277727 未加载
评论 #16277477 未加载
评论 #16277321 未加载
评论 #16278022 未加载
simiasover 7 years ago
The idea to use a real programming language as a shell is a common one but I&#x27;m not sure it&#x27;s really a problem that can be solved without reworking the kernel interface. Whatever you do pipes will still be byte streams, error handling will always be using integer return values, you&#x27;ll always have stdin, stdout and stderr, job control and signal handling will always work pretty much the same way. The kernel interface exposes an interface, the userland app expect the shell to behave in the certain way, there&#x27;s not a lot of wiggle room to make things differently in between the two.<p>Not that the POSIX-like shell syntax is not all sorts of clunky and odd but I almost consider it a feature, it&#x27;s a deterrent to force you to move to a &quot;real&quot; scripting language when the concepts become too complex to express in a shell script.
评论 #16278140 未加载
评论 #16278048 未加载
kevlar1818over 7 years ago
&gt; However, Python and Ruby aren&#x27;t good shell replacements in general. Shell is a domain-specific language for dealing with concurrent processes and the file system. But Python and Ruby have too much abstraction over these concepts, sometimes in the name of portability (e.g. to Windows). They hide what&#x27;s really going on.<p>Excellently put. POSIX shell languages have fantastic capabilities you just can&#x27;t get in most other languages. I would love to see a more safe, more sane shell language gain enough popularity to change the narrative that &quot;shell scripts are dangerous and impossible to maintain.&quot;<p>The contrasts to Python and Ruby made me think of xonsh[1], a Python-based shell that can dynamically switch between Bash-like syntax and standard Python. It&#x27;s not quite ready to become my daily driver, but I&#x27;m still excited about it.<p>[1]: <a href="https:&#x2F;&#x2F;xon.sh" rel="nofollow">https:&#x2F;&#x2F;xon.sh</a>
评论 #16278279 未加载
评论 #16278100 未加载
评论 #16280614 未加载
jernfrostover 7 years ago
I essentially solved these problems with fish shell and Julia programming language.<p>For all sorts of interactive stuff I use fish, because it works the way you want for the most common tasks. I can use it to really quickly match and get back previous statements or do a completion.<p>Also much easier to configure and grok than bash, because it has saner syntax and is a simpler shell language.<p>However when writing shell scripts I use a real language like Julia. It integrates very well with the shell world so I don&#x27;t find it problematic to do this. It is very easy to read output from processes and pipe stuff. Much nicer than say Python or Ruby.<p>You got built in syntax to deal with shell stuff, but then didn&#x27;t make it crazy so you end up with a mess like perl. Julia is actually a very clean and nice language. Which also happens to blistering fast and have LISP style macros.
castisover 7 years ago
I see that this person has opted not to use python 3 because it is &#x27;less-suited to shell-like problems&#x27; than python 2.<p>In an effort to understand the reasons for actively choosing against 3, does anyone know what problems those would be?
评论 #16277358 未加载
评论 #16277332 未加载
评论 #16277578 未加载
评论 #16277405 未加载
zapitaover 7 years ago
Finally a modern shell that understands the importance of COMPATIBILITY! This gives it a realistic chance of getting real adoption. Shells like zsh and fish will never get mainstream adoption because they are not compatible with bash.
评论 #16277435 未加载
评论 #16277594 未加载
评论 #16277532 未加载
评论 #16277456 未加载
评论 #16278952 未加载
评论 #16284450 未加载
评论 #16277418 未加载
评论 #16277509 未加载
anderspitmanover 7 years ago
Love it. I think there&#x27;s plenty of room for innovation in this space. I&#x27;m currently in the process of porting a ~700 line bash script (I didn&#x27;t write it) to Python. Although longterm I think this will be much better for the project, there are still tradeoffs. There are some things that are just so easy to express in shell language, like composing transformations via pipes. Sure, python can do it, but it feels clunky in comparison to me. I would love to see a language like python (including package ecosystem) written with shell use as a first-class citizen.
评论 #16281056 未加载
dmixover 7 years ago
I checked out Oil previously which looks nice but more of an incremental improvement over Fish&#x2F;ZSH rather than a significant evolution (it may have changed since then, this was last year).<p>Im most excited about Elvish shell and the language that&#x27;s being developed around it. The shell is built with Go and feels super fast compared to my plugin-heavy ZSH. The language design is quite nice too but still very alpha. Looking forward to see what it evolves into...<p><a href="https:&#x2F;&#x2F;github.com&#x2F;elves&#x2F;elvish" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;elves&#x2F;elvish</a>
评论 #16278106 未加载
JepZover 7 years ago
@chubot: There is one use-case I come across every once in a while:<p><a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;356100&#x2F;how-to-wait-in-bash-for-several-subprocesses-to-finish-and-return-exit-code-0" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;356100&#x2F;how-to-wait-in-ba...</a><p>So whenever you want to do things in parallel there is probably a limit to the number of processes you would like to execute in parallel (e.g. the famous compiler limit formula: number of CPU cores +1). It would be great if Oil could support such a use-case out of the box, as easy parallelism without the ability to artificially limit the number of parallel executions is often useless.
评论 #16280196 未加载
z3t4over 7 years ago
I spent the day making a virtual terminal ... I think the terminal is an unnecessary layer. All program UI is limited by this 40+ year old technology that is the terminal. Instead of making a new shell, make a shell + <i>new</i> user-interface.
评论 #16284548 未加载
评论 #16278113 未加载
评论 #16277890 未加载
评论 #16280443 未加载
评论 #16279670 未加载
tambourine_manover 7 years ago
A little tangential, but I keep wondering if Apple is developing its own shell or will adopt one with a more liberal licence such as Oil or Fish.<p>I mean, they can&#x27;t keep using Bash 3 forever, right? (Hope)
评论 #16277808 未加载
评论 #16277836 未加载
评论 #16280436 未加载
评论 #16279539 未加载
unixheroover 7 years ago
Ignore the naysayers. I have encountered them when posting my shell activities. You&#x27;re doing great! Can&#x27;t wait to try the final release. Maybe even get it into my workflow.
jiggunjerover 7 years ago
So many shells, but how come the virtual terminal hasn&#x27;t got a revamp or popular alternative? I&#x27;d like to see more control over keybinding (e.g. on my machine pressing ctrl+del sends the same character as pressing ctrl+backspace). I understand this would be more a kernel change than a userland one.<p>Screen tiling and visual &#x27;tabs&#x27; would also be welcome additions. Not everyone needs a graphic environment, and I refuse to install X just for better keyboard shortcuts on my terminal.
评论 #16284153 未加载
评论 #16279616 未加载
JepZover 7 years ago
Sounds pretty cool and everybody who had to learn bash scripting at some point understands why we need a sane language (my favorite are misplaced spaces in if statements...; Disclaimer: I do and love bash scripting but while the language has cool concepts, some things are just broken by design).<p>Nevertheless, there is one piece in this puzzle I am missing. There does not seem to be a process which manages the &#x27;core software set&#x27; across platforms. So after decades we finally have a shell which is available on most operating systems, but how long will it take before Microsoft, Apple, Oracle, etc. will adopt a new shell?<p>So why don&#x27;t the large OS corporations form a consortium to define something like a &#x27;cross platform run time environment&#x27; standard (maybe together with the Linux Foundation and some BSD guys?). I mean its not so much about which shell someone prefers, but more about a common set of interpreters and maybe tool kits. And even more than that it is not about the state but the process&#x2F;progress.<p>What do you think, do we need such a process or is there another way to solve the cross platform dilemma?
评论 #16278993 未加载
评论 #16280212 未加载
评论 #16278468 未加载
XorNotover 7 years ago
The pain of &quot;not quite bash&quot; ultimately is what put me off xonsh as my daily shell. Also losing it whenever I SSH&#x27;d somewhere.<p>The latter problem could probably be solved with a wrapper which would pipe and execute the shell (or a bytecode interpreter ala shuttle?) automatically - but I&#x27;ve seen no alternative shell project take this part seriously for the problem space.
fnord77over 7 years ago
&gt; Oil is taking shell seriously as a programming language, rather than treating it as a text-based UI that can be abused to write programs.<p>erm, there&#x27;s a big difference between a command scripting language and a programming language. These should be treated as different things.<p>I have years of experience using both, and I really don&#x27;t want to be doing shell tasks in a programming language and I don&#x27;t want to write programs in a shell language. Those sorts of hybrids are almost always mediocre. Horses for courses and all that.<p>There&#x27;s a reason bash keeps being used - it&#x27;s mature, it&#x27;s simple, it&#x27;s easy and people are productive with it.
aplorbustover 7 years ago
This keeps showing up on the front page. No doubt it will have users.<p>Lets say there are two uses of a shell: 1. interactive and 2. non-interactive (scripting).<p>Lets imagine the commandline user is learning about her OS. She learns it is heavily reliant on shell scripts to build and (if desired) to automate starting services.<p>She realises that to understand the OS she will have to learn the shell that the OS developers used for scripting.<p>Then she realises that if she chooses another shell for interactive use, she will have to learn <i>two</i> shells.<p>Finally she realises that any script she writes in the &quot;non-interactive&#x2F;scripting&quot; shell <i>will also run under the interactive one</i>. But not vice versa.<p>If she only has enough time in life to master one shell, which one should she choose?<p>Over time I found I really cared more about the scripting aspect of a shell than the interactive facet.<p>The scripting shell used by the OS authors might be an Almquist derived shell, for instance.<p>Occasionally the ash Im using gets a new &quot;feature&quot; but not too often. I like that it stays relatively small. The latest &quot;feature&quot; is LINENO.<p>But I also use a smaller version of this shell with no command line history, no tabcomplete, etc. IMO, there is no better way to learn how to reduce keystrokes. It has led to some creativity in this regard for which I am thankful.<p>After &quot;mastering&quot; ash, I started using execlineb, pipeline and fdmove. I am starting to use more components of execline and am continually replacing ash scripts with execline scripts for more and more daily work.<p>I guess we will never see execline on the front page, which I think would be interesting because I would like to hear whatever harsh critique HN can muster.<p>Seeking a better <i>non-interactive&#x2F;scripting</i> experience, I have experimented with many other shells over the years, and written simple execve &quot;program launchers&quot;, but in this vein, I have not found anything that compares to execline.<p>The speed gains and resource conservation are obvious, but with the ability to do &quot;Bernstein-chaining&quot; and the <i>option</i> to use djb low-level functions instead of libc, it is a rare type of project.<p>The speed and cleanliness of the compilation process is, compared to all the other crud one routinely encounters in open source projects, &quot;a thing of beauty&quot;. Humble opinion only, but I think others might agree.
评论 #16284338 未加载
petreover 7 years ago
Oil syntax looks pretty much like Tcl and Th[1] so the author could have probably just used Th. It has saner ways to copy arrays than<p><pre><code> b = [ @a ] </code></pre> which pretty much looks like Perl with added line noise. Why are the [] even necessary when it&#x27;s clear @a is an array?<p>1. <a href="http:&#x2F;&#x2F;www.sqliteconcepts.org&#x2F;THManual.pdf" rel="nofollow">http:&#x2F;&#x2F;www.sqliteconcepts.org&#x2F;THManual.pdf</a>
desireco42over 7 years ago
As a fish user, I didn&#x27;t really get where the advantages lie as clearly. I am for developing new shells, we really need this, innovation is important.<p>As for new language, I feel like if you want to script things, you can use ruby or python, hell, perl will do and you could be fine. I don&#x27;t want to be unfair to this effort, I just feel that it is not for me and I am tinkerer.
tyingqover 7 years ago
Applaud the idea, but you are fighting a ton of inertia. I have to wonder if drawing a more clear line of when to go to Perl, Python, Lua, Ansible, Golang, etc, might be more fruitful. Sometimes, a shell script solution is just drawing any kind of shell too far outside it&#x27;s core competency.
cestithover 7 years ago
In your FAQ you decry Perl as having no ability to redirect around other programs. Yet you don&#x27;t explain how any of the following fail to meet those needs.:<p>* <a href="http:&#x2F;&#x2F;perldoc.perl.org&#x2F;functions&#x2F;open.html" rel="nofollow">http:&#x2F;&#x2F;perldoc.perl.org&#x2F;functions&#x2F;open.html</a><p>* <a href="http:&#x2F;&#x2F;perldoc.perl.org&#x2F;IPC&#x2F;Open2.html" rel="nofollow">http:&#x2F;&#x2F;perldoc.perl.org&#x2F;IPC&#x2F;Open2.html</a><p>* <a href="http:&#x2F;&#x2F;perldoc.perl.org&#x2F;IPC&#x2F;Open3.html" rel="nofollow">http:&#x2F;&#x2F;perldoc.perl.org&#x2F;IPC&#x2F;Open3.html</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~odc&#x2F;IPC-Open2-Simple-0.01&#x2F;lib&#x2F;IPC&#x2F;Open2&#x2F;Simple.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~odc&#x2F;IPC-Open2-Simple-0.01&#x2F;lib&#x2F;IPC&#x2F;Op...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~exodist&#x2F;Child-0.013&#x2F;lib&#x2F;Child.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~exodist&#x2F;Child-0.013&#x2F;lib&#x2F;Child.pm</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~rkrimen&#x2F;IPC-RunSession-Simple-0.002&#x2F;lib&#x2F;IPC&#x2F;RunSession&#x2F;Simple.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~rkrimen&#x2F;IPC-RunSession-Simple-0.002&#x2F;...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~trski&#x2F;Proc-Forkmap-0.025&#x2F;lib&#x2F;Proc&#x2F;Forkmap.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~trski&#x2F;Proc-Forkmap-0.025&#x2F;lib&#x2F;Proc&#x2F;Fo...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~toddr&#x2F;IPC-Run-0.96&#x2F;lib&#x2F;IPC&#x2F;Run.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~toddr&#x2F;IPC-Run-0.96&#x2F;lib&#x2F;IPC&#x2F;Run.pm</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~ayoung&#x2F;IPC-Run3-Simple-0.011&#x2F;lib&#x2F;IPC&#x2F;Run3&#x2F;Simple.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~ayoung&#x2F;IPC-Run3-Simple-0.011&#x2F;lib&#x2F;IPC...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~rjbs&#x2F;IPC-Run3-0.048&#x2F;lib&#x2F;IPC&#x2F;Run3.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~rjbs&#x2F;IPC-Run3-0.048&#x2F;lib&#x2F;IPC&#x2F;Run3.pm</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~djerius&#x2F;IPC-PrettyPipe-0.03&#x2F;lib&#x2F;IPC&#x2F;PrettyPipe.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~djerius&#x2F;IPC-PrettyPipe-0.03&#x2F;lib&#x2F;IPC&#x2F;...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~xan&#x2F;IPC-Pipeline-1.0&#x2F;lib&#x2F;IPC&#x2F;Pipeline.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~xan&#x2F;IPC-Pipeline-1.0&#x2F;lib&#x2F;IPC&#x2F;Pipelin...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~sscaffidi&#x2F;IPC-OpenAny-0.005&#x2F;lib&#x2F;IPC&#x2F;OpenAny.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~sscaffidi&#x2F;IPC-OpenAny-0.005&#x2F;lib&#x2F;IPC&#x2F;...</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~glai&#x2F;IPC-Exe-2.002001&#x2F;lib&#x2F;IPC&#x2F;Exe.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~glai&#x2F;IPC-Exe-2.002001&#x2F;lib&#x2F;IPC&#x2F;Exe.pm</a><p>* <a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~zefram&#x2F;IPC-Filter-0.005&#x2F;lib&#x2F;IPC&#x2F;Filter.pm" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~zefram&#x2F;IPC-Filter-0.005&#x2F;lib&#x2F;IPC&#x2F;Filt...</a>
评论 #16278159 未加载
shmerlover 7 years ago
I recently discovered Fish, which is actually not that recent, but also an interesting shell.
wainsteadover 7 years ago
&gt; Shouldn&#x27;t we discourage people from writing shell scripts?<p>...people frequently ask this? Tip #21 of &quot;The Pragmatic Programmer&quot; states: &quot;Use the Power of Command Shells.&quot;
评论 #16277535 未加载
评论 #16277450 未加载
zimbatmover 7 years ago
What I would really like to see happening in Oil shell is a way to run a strict subset of the bash language. Ideally with a tool to convert existing scripts in that subset.
breatheoftenover 7 years ago
I would love an interactive shell that applies a type-checker to my input before running it ... is that really an infeasible desire in 2018 ...?
fiatjafover 7 years ago
What kind of shell can I run on a server without filesystem access that I can open to external untrusted users?
评论 #16279247 未加载
评论 #16277755 未加载
chrisvalleybayover 7 years ago
Why is it called Oil? That name is so loaded. I think it actually will give it less of a chance.
评论 #16283835 未加载
评论 #16280869 未加载
Sir_Cmpwnover 7 years ago
I use fish but I hate it. My perfect shell is strictly POSIX sh but has a better interactive experience (better tab completion and typeahead like fish has).
fiatjafover 7 years ago
Wasn&#x27;t there a in-browser Javascript shell somewhere a while ago? It could fetch URLs and do cool stuff with APIs.
fanf2over 7 years ago
No mention of plan9 rc or Tcl so it is hard to believe it is really breaking the mould
psibiover 7 years ago
Looks nice! Any reason why Apache was used as it&#x27;s license ?
oleksover 7 years ago
Why is Oil implemented in Python? IMO Python is a terrible language for writing programming languages.
评论 #16277734 未加载
评论 #16277874 未加载
评论 #16277581 未加载
donatjover 7 years ago
I was with the guy right up until the bile laden PHP hated started coming in as a justification.
评论 #16280225 未加载
devitover 7 years ago
Seems an interesting idea, but it&#x27;s implemented in Python, which means it will never replace bash and probably not achieve any significant adoption unless they rewrite it in Rust first (which they should have written it in to begin with since they started in 2016).<p>The reasons for that are that shells must start very quickly (due to subshells, local ssh, etc.), be fast, have no complex dependencies since they are used to recover broken systems, be portable but also with full support for OS semantics and be written in a language that allows rapid development of robust software, none of which Python does well.
评论 #16279110 未加载