Live data from Hacker News

Nsh: A fish/bash-like Posix shell in Rust

github.com

31–40 of 56 posts

Re: Nsh: A fish/bash-like Posix shell in Rust

#31
post #6

Earlier quoted context omitted.

The trick is to enter bash from fish, run your command, and then call fish again. (fish)$ bash (fish>bash)$ source ./random.sh (fish>bash)$ fish (fish>bash>fish)$

Or just simply: (fish)$ bash -c ./random.sh

No need to use -c there:

    (fish)$ bash random.sh

Re: Nsh: A fish/bash-like Posix shell in Rust

#32
post #30

> I don't need customizability Configuration isn't for you. It's for other people. Configuration is the part of a program that performs the function of making it useful for more than one person. It is the necessary glue that brings together many developers and many users into one project.

Software that requires configuration to be useful to more than one person has failed it's mandate in proportion to that configurability. It's precisely the opposite of necessary glue, it's duct tape: often the pragmatic choice, but almost always a sign of a design failure.

Re: Nsh: A fish/bash-like Posix shell in Rust

#33

Earlier quoted context omitted.

As someone who stopped using fish, I found fzf to be more useful than fish’s history completion so it became less tolerable to have to type `env` in front of the bash oneliners our test runner puts out.

Just noting that fish supports the `var=val cmd` syntax starting in 3.1, so `env` shouldn't be necessary.

how did I miss this??? I've been continuing to use the env command for this for more than a year now

womp womp

Re: Nsh: A fish/bash-like Posix shell in Rust

#34
post #15

> Fish is really neat but I prefer old-fashioned, traditional, and ergonomic shell syntax. What does this really mean? Especially the ergonomic part?

I do not know what was meant, but for example when I have looked at fish, I have seen some features that appeared to be nice, but also some gratuitous changes to the core shell syntax that were not improvements. For example, replacing "&&" and "||" with "and" and "or", is not an improvement. There are many other such changes that make the shell more verbose without bringing any advantage. This also happened with the…

> some gratuitous changes to the core shell syntax that were not improvements

> For example, replacing "&&" and "||" with "and" and "or", is not an improvement. There are many other such changes that make the shell more verbose without bringing any advantage.

In Fish, `and` was never a synonym for `&&`, and `or` was never a synonym for `||`. Fish's use of `and` and `or` also did not introduce any syntax that you won't find in Bash and friends. `and` and `or` in Fish are _commands_, and they use the _pre-existing syntax_ for _normal commands_.

This is absolutely an improvement, because it's strictly less syntax that allows you to do all of the same things with virtually no increase in the number of characters. `; or` is only a single character more than ` ||`, and `;or` is the same number of characters as ` ||`. This is a very bad example of ‘increased verbosity’.

Re: Nsh: A fish/bash-like Posix shell in Rust

#35
post #30

> I don't need customizability Configuration isn't for you. It's for other people. Configuration is the part of a program that performs the function of making it useful for more than one person. It is the necessary glue that brings together many developers and many users into one project.

Software that requires configuration to be useful to more than one person has failed it's mandate in proportion to that configurability. It's precisely the opposite of necessary glue, it's duct tape: often the pragmatic choice, but almost always a sign of a design failure.

What utter tosh. People have different preferences because people are different. If your point was apt then this submission wouldn’t exist because $SHELL wouldn’t be a configurable option in the first place.

Re: Nsh: A fish/bash-like Posix shell in Rust

#37

Earlier quoted context omitted.

Or just simply: (fish)$ bash -c ./random.sh

That doesn't give you the env vars that the script might have set.

could you explain this? How could the script set env vars before you run it??

Re: Nsh: A fish/bash-like Posix shell in Rust

#38
post #7

Earlier quoted context omitted.

I think you should hit ctrl+d when you are done in bash to avoid the nested fish>bash>fish.

The idea is to return to a fish shell, but with all the env-vars that bash might have loaded as a result of executing the script.

`exec ` would avoid nested shells and inherit the environment. Which might be preferable if you find your terminal emulator complaining about processes still running on close.

Re: Nsh: A fish/bash-like Posix shell in Rust

#39
post #2

Very cool. I really love fish but sometimes find it very annoying to translate random posix snippets from the web.

With Fish 3.0 and 3.1 it’s even more compatible with snippets you are likely to find to copy and paste. Do you remember something you found that doesn’t work?

Re: Nsh: A fish/bash-like Posix shell in Rust

#40
post #3

Looks like the goal of this project is to be a replacement for bash with improved interactivity. That seems reasonable, compared to what you can do with zsh or fish bash is far behind concerning interactivity. While I personally think shells that abandon POSIX/bash compliance are much more interesting as those can implement a sane scripting language, sticking with bash but improving interactivity is probably going to…

Totally agree, but having used zsh, fish and elvish as my daily driver shell (each for at least 1 month) I think that not having POSIX/bash compliance eventually becomes an annoyance.

I like zsh because it is mostly (entirely?) POSIX compliant, but adds extended features. I think that's the best approach to make it easier for people to start using your shell.

random note: back when the Go language was first released I wanted to try it out.. I started making a shell that I called GoSH. Didn't get very far, you could execute programs, change directories etc. It was fun! And taught me a lot about low level languages.

Post reply on HN