Live data from Hacker News

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

news.ycombinator.com

81–90 of 146 posts

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

#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%json}yml"; done
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 \;
Your second example would be:

    (
        cd "$(which npm.ps1)" && \
        for f in *.ps1; do printf "alias %s='powershell.exe %s'\n" "${f%.ps1}" "$f"; done
    ) >file

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

#85
At work, I would use the workplace standard, for easy sharing and interop with colleagues and systems. Work scripting has been Bash because that's been the default (so far).

Personally, Bash is stuck to my fingers out of habit.

I tend to write my scripts in a Functional Programming style, which plays well with stdio and pipes, and makes for composable and testable code.

Like this: https://www.evalapply.org/tags/bash/

edit: add reference

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

#86
post #32

How about instead of changing the shell get more out from your existing one. Starship [0] and fzf [1] will make your life much easier in any shell. I use fish but they work with bash, zsh and the like. [0] https://starship.rs/ [1] https://github.com/junegunn/fzf

I use one fish plugin and it's a total gamechanger

https://github.com/PatrickF1/fzf.fish

Being able to instantly fuzzy find files, directories, git history, processes, environment variables and command history is like having a superpower.

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

#87
Trying out various shells (and converting my various scripts) has been somewhat of a hobby of mine for the past several weeks. Long story short, I settled on using fish both as my shell and as the language to write my scripts in.

nushell is really, really great as a shell but I find it far too limiting in some cases to use as a scripting language. For example, you can't build a non-external command from a string and run that command. I'll definitely come back to nushell in the future.

elvish is also really great, especially as a scripting language (being able to pass around lambdas is amazing), but ultimately fish has so much community support and so many nice plugins that it's hard to justify using anything else at the moment.

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

#88

Given that Fish is switching to Rust, I'm considering Fish as my alternate shell. I've tried many, but I always end up going back to Bash. Is there any reason why you think Fish isn't enough, and you're looking at super-niche ones?

Funny I'm considering switching off fish for that exact reason. I figure it will be stuck in place for years during the rewrite, and may never release another major version.

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

#89
I've used Fish for about 2 years now. Before that I used ZSH for about 6 months. I'm relatively new daily driving Linux. About 3 years.

The thing about ZSH that made me jump ship was that even though you can customize it like fish (with Oh My ZSH plugins) ZSH was always slow or didn't display some things correctly. It was frustrating having to wait a few seconds for a command or having things just not work out correctly.

Fish, on the other hand, is fast and has a lot of quality of life features like typing part of a command and then serach with the up key. I didn't even install any plugins (I like to Fisher[1]).

Also, Fish has gotten me more and more into shell scripting. The docs for Fish are very clear and easy to navigate. I love how you can have custom scripts on the .config folder or abbreviations[2], which I think are superior to aliases since they expand into the command you're calling.

I was using it as the default shell for my user until recently and it was fine, but I have gone back to Bash as my default shell and just set my terminal emulator to start into Fish on startup. I didn't have any incident. I just wanted to avoid anything unexpected further down the line.

[1]: https://github.com/jorgebucaran/fisher

[2]: https://fishshell.com/docs/current/interactive.html#abbrevia...

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

#90
post #80

I've been using nushell for the past year, and I love it. For a while I kept bash as my login shell and had nu as my default command in tmux. This had the advantage of allowing a bunch of environment setup to run in bash and get inherited, which allowed my overall setup to be more vanilla (and also nushell doesn't have any kind of job control, so something like tmux is probably a must). About two months ago I promote…

How is nushell for interactive use? Prompt configuration, stuff like that? Also, how stable is it? Especially when interacting with weirder stuff like tmux, vim, ncurses apps?

I would say interactive use is good. Not hard to configure prompts.

Stability (in the sense of not crashing) is decent, it's been a long time since I've crashed Nushell. We do get the occasional crashing bug filed but most of those are in areas like our completion engine rather than interacting with external tools.

OTOH, command design and language are not entirely stable; we are still pre-1.0 and we do make breaking changes fairly often.

(I work on Nushell)

Post reply on HN