Live data from Hacker News

Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

news.ycombinator.com

131–140 of 146 posts

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#131
(Oil author here) We're making great progress on polishing Oil -- namely semi-automatically translating it to C++ -- but can still use more help.

In particular, starting in October, contributor Melvin Walls has almost single-handedly enabled the interactive shell to be translated, including some of the hardest bits like shell traps, signal handling, and GNU readline bindings.

I was a little worried that we'd run into difficulties with our style of Python and this "inverted" / callback-heavy component, but the result is better than I expected. Melvin came up with creative and solid solutions.

So we have a tiny garbage-collected runtime, and the rest is statically-typed, memory safe Python code. (We learned first hand that memory safety is especially important when you're interfacing with a garbage collector.)

-----

So we need more people who can put in some elbow grease. You can even be paid to work on open source code! We just got a second grant from NLnet, which I mentioned on the blog.

https://news.ycombinator.com/item?id=34221617

https://www.oilshell.org/blog/

-----

There are a few misconceptions in this thread which make me realize I need to update the blog:

1) The Oil project contains OSH, which is not only POSIX- compatible, but bash-compatible. Some people don't believe that it could be both things -- how could it be both compatible and new? But that is absolutely true (and a major reason why it's a big project!)

You can type 'osh' and it will run your existing shell scripts, or type 'oil', and it's a brand new language. ( Tour: https://www.oilshell.org/release/latest/doc/oil-language-tou... )

(Note: I also plan to slightly rename the project, to address this confusion, since I've encountered it before. It's confusing that "Oil" is both the whole project and a component of the project.)

-----

2) On the other hand, the Oil language is NOT "just waiting to be deployed". There are a few TODOs in that doc, and they're actually quite big. Though filling them in is going to lead to something pretty great which spans a variety of domains, IMO. I hope to write a few blog posts about that in the coming months.

As always feel free to check out the code and join Zulip. On most Linux distros you can get a working bin/osh in about 30 seconds:

https://github.com/oilshell/oil/wiki/Contributing

The code is in great shape, and completely different than it was 6 months ago. Especially the C++ side. But you can just hack on Python, with MyPy, and it just works!

The tools are also very solid now, with dozens of cleanups/fixes even in the last few weeks. Getting the GC working was a big breath of fresh air that unlocked a lot of possibilities.

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#132

Earlier quoted context omitted.

You can easily get bash to do that by adding these lines to your .inputrc file. "\e[A": history-search-backward "\e[B": history-search-forward "\e[C": forward-char "\e[D": backward-char

Most things in fish can be achieved with customization and configuration in other shells, like zsh or bash. The point of fish is a sane set of defaults that doesn't require customization and is good enough.

They are explicitly against configuration options though. Good luck if their opinions about what's sane doesn't match your own. By the way I have that feature in zsh myself. Quite useful.

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#133
post #132

Earlier quoted context omitted.

Most things in fish can be achieved with customization and configuration in other shells, like zsh or bash. The point of fish is a sane set of defaults that doesn't require customization and is good enough.

They are explicitly against configuration options though. Good luck if their opinions about what's sane doesn't match your own. By the way I have that feature in zsh myself. Quite useful.

> Good luck if their opinions about what's sane doesn't match your own.

Thank you, and yes, that's when you don't use fish.

The point of fish is being for people who are fine with the defaults set by the authors. It's the core selling point.

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#134

Earlier quoted context omitted.

Most things in fish can be achieved with customization and configuration in other shells, like zsh or bash. The point of fish is a sane set of defaults that doesn't require customization and is good enough.

Best feature of fish is the fact that my fish dotfiles are about 100loc max with a fully async prompt. Comparable functionality in zsh would be 500loc of ultra obscure tweaks :)

What do you mean by "fully async prompt"?

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#135
post #84
post #51

Nushell is great for simple tasks. i.e. ls **/data.json | each {|it| mv $it.name $"(dirname $it.name)/data.yml" } Will be much more complex in bash find -name "data.json" | xargs -i bash -c "mv \"{}\" \"\$(dirname '{}')/data.yml\"" Note the escaped quotes and dollar signs in bash. It is really difficult to get them right. In Nutshell we are actually using "functions" (supported syntax-wise) to do the job, so it will…

I'm sorry but obviously you had to learn how to use nushell but you didn't learn how to use find (you don't need xargs) or bash (you don't need find). Your first problem solved in bash: shopt -s globstar for f in ./**/data.json; do mv "$f" "${f%json}yml"; done You can do it without globstar (without running into weird issues with newlines) like so: find . -name data.json -print0 | while read -rd '' f; do mv "$f" "${f…

> Now, since the particular problem doesn't require a shell at all, you can solve it entirely in find: find . -name data.json -execdir mv {} data.yml \;

How do you do that without a shell?

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#136
post #84
post #51

Nushell is great for simple tasks. i.e. ls **/data.json | each {|it| mv $it.name $"(dirname $it.name)/data.yml" } Will be much more complex in bash find -name "data.json" | xargs -i bash -c "mv \"{}\" \"\$(dirname '{}')/data.yml\"" Note the escaped quotes and dollar signs in bash. It is really difficult to get them right. In Nutshell we are actually using "functions" (supported syntax-wise) to do the job, so it will…

I'm sorry but obviously you had to learn how to use nushell but you didn't learn how to use find (you don't need xargs) or bash (you don't need find). Your first problem solved in bash: shopt -s globstar for f in ./**/data.json; do mv "$f" "${f%json}yml"; done You can do it without globstar (without running into weird issues with newlines) like so: find . -name data.json -print0 | while read -rd '' f; do mv "$f" "${f…

I didn't learn Bash from scratch. I just serach Google/StackOverflow for similar questions.

But that is the point, there are too many commands to do the same job in Bash, each with dozens of flags. It is hard to learn them all, or even find the right command (like shopt, read) or flag (like -rd, print0, -execdir) in the first place.

That's why Nutshell will be simpler for small tasks.

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#137
post #84

Earlier quoted context omitted.

I'm sorry but obviously you had to learn how to use nushell but you didn't learn how to use find (you don't need xargs) or bash (you don't need find). Your first problem solved in bash: shopt -s globstar for f in ./**/data.json; do mv "$f" "${f%json}yml"; done You can do it without globstar (without running into weird issues with newlines) like so: find . -name data.json -print0 | while read -rd '' f; do mv "$f" "${f…

> Now, since the particular problem doesn't require a shell at all, you can solve it entirely in find: find . -name data.json -execdir mv {} data.yml \; How do you do that without a shell?

IIRC running a command without piping/string semantics doesn't involve a shell, such as os.system() in python and child_process.exec() in Node.js.

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#138
post #136
post #84

Earlier quoted context omitted.

I'm sorry but obviously you had to learn how to use nushell but you didn't learn how to use find (you don't need xargs) or bash (you don't need find). Your first problem solved in bash: shopt -s globstar for f in ./**/data.json; do mv "$f" "${f%json}yml"; done You can do it without globstar (without running into weird issues with newlines) like so: find . -name data.json -print0 | while read -rd '' f; do mv "$f" "${f…

I didn't learn Bash from scratch. I just serach Google/StackOverflow for similar questions. But that is the point, there are too many commands to do the same job in Bash, each with dozens of flags. It is hard to learn them all, or even find the right command (like shopt, read) or flag (like -rd, print0, -execdir) in the first place. That's why Nutshell will be simpler for small tasks.

No, the point is that if you go into a discussion saying: "X is better than Y but I should warn you that I never bothered learning Y but instead spent my time learning X" your ability to provide an accurate comparison is already put into question.

Then you go on and provide examples of extremely sub-optimal Y code and compare it to X code you wrote.

It's very uncharitable and very difficult to tell what is actually better. It doesn't matter if X or Y is better at this point because you haven't provided a fair comparison. And while I agree that bash is shit, I need a lot more than "here's some poorly written bash code compared to nushell" to persuade me to switch to something less ubiquitous.

Since bash and presumably nushell are both turing complete, there should be an infinite number of ways of achieving any task, what you want to compare is the shortest but so short that they're difficult to comprehend solutions, and there aren't that many. I can't tell if you picked the most idiomatic nushell solutions to your problems but I can definitely tell you didn't do the same for bash.

If you're happy to use nushell you would probably be happy to enable globstar in your shell. So my first solution would be comparable to your nushell version. And yes, you need to know what globstar is, just like you would need to know what nushell is.

Given that bash and presumably nushell both support running arbitrary commands the find version is actually shell independent and the fact that you don't know how to use find isn't bash's problem.

Let's put it this way, given I don't know nushell, I would also have to learn the iterator, lambda, and variable substitution syntax (each, ||, $v.name). I know how equivalents of those features work in bash (for, $...). I don't find your code any easier to read by default (without having to make guesses as to how nushell works). If I claimed right now that I find nushell syntax to be confusing, weird and unusual, would you think it would be fair for me to say that based on reading only your code?

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#139
post #84

Earlier quoted context omitted.

I'm sorry but obviously you had to learn how to use nushell but you didn't learn how to use find (you don't need xargs) or bash (you don't need find). Your first problem solved in bash: shopt -s globstar for f in ./**/data.json; do mv "$f" "${f%json}yml"; done You can do it without globstar (without running into weird issues with newlines) like so: find . -name data.json -print0 | while read -rd '' f; do mv "$f" "${f…

> Now, since the particular problem doesn't require a shell at all, you can solve it entirely in find: find . -name data.json -execdir mv {} data.yml \; How do you do that without a shell?

I mean obviously you need some way of executing the command and you're probably not going to write a C program to call execve to do it, but the point is that it doesn't involve any shell features and aside from the escape syntax for the semicolon is completely shell independent.

Re: Ask HN: Are alternative (oil, nu, etc.) shells usable as daily drivers?

#140

Earlier quoted context omitted.

PowerShell has strange command names? Compared to what? grep, sed, awk, and a bunch of two letter abbreviations from the before-times?

Compared to what the majority of people who frequently use the terminal are used to.

It’s different so it’s bad. /s
Post reply on HN