Live data from Hacker News

Nushell: Introduction to a new kind of shell

dataswamp.org

231–240 of 252 posts

Re: Nushell: Introduction to a new kind of shell

#232

Earlier quoted context omitted.

And what a great Terminal emulator it is.

Agreed; it’s a massive step forward for Windows and the team behind it is great.

It blows my mind that they have a proper team behind WT now (for a while now), and it has already (in my mind) surpassed MacOS Terminal (unchanged for years) and most of Linux Terminal Emulators.

If Microsoft can just get a proper team behind the other tech...

Re: Nushell: Introduction to a new kind of shell

#233
Nushell looks pretty good!

But, how to automatically convert all existing shell scripts -- to Nushell?

I think it would be highly interesting if someone created "an LLVM for shell scripts"...

In other words -- given a shell script that runs on one shell, turn that into a parse tree -- then transpile that parse tree back into a script such that the transpiled script runs on a different shell -- with guaranteed full compatibility...

Maybe some work in this area is being done, or already has been done...

I'd be interested if anyone knew of anything like this...

If so -- then links would be appreciated!

Re: Nushell: Introduction to a new kind of shell

#234

Earlier quoted context omitted.

> I may never write a bash script again I wrote 2x 200 line-ish shell scripts recently, and it was simply terrible, and although I'm increasingly convinced we need a shell like abstraction, I can't believe `bash` is the best we can do. Really hope I find one of these alt shells that suits me. Not a fan of Python but xonsh looks really cool too.

Bash is not the best we can do! If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out Zsh. It has a ton of complicated features, but most Bash scripts can be ported easily (if not outright copied and pasted). Zsh has fewer footguns by default than Bash, and it has more "safety" settings that you can enable. There is also the Oil shell, whose creator often posts o…

Elvish:

    $E:HOME'/.local'

Re: Nushell: Introduction to a new kind of shell

#235

Just was trying it. A couple minutes in, I discovered it doesn't support suspended jobs. :( seems like that would be a very basic feature. https://github.com/nushell/nushell/issues/1329 https://github.com/nushell/nushell/issues/1796 https://github.com/nushell/nushell/discussions/5239

I also use tmux for this. Personally, since starting to use tmux years ago, I've never even thought of wanting job control in an interactive shell process.

Re: Nushell: Introduction to a new kind of shell

#236
post #102
post #67

Earlier quoted context omitted.

Do you use pwsh as your daily driver? I find that its commands are as easily memorable as any other shell. That being said You should enable these: Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete Set-PSReadLineOption -PredictionSource History MenuComplete will give you a menu of arguments that each command takes so you can easily see them when pressing tab for completions and prediction source will try to pr…

Also make sure you're on latest version of PSReadLine (I had some problems with it not updating properly and had to do a manual `Install-Module PSReadLine -Force`) and try Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView You can also toggle between the default inline and listview with F2. Also if you install Install-Module CompletionPredictor and add this to your profile: Import-M…

Been using the latest PSReadline but CompletionPredictor is awesome and exactly what I've been looking for.

One other PowerShell protip

Ctrl+Space is also another great shortcut for completing commands, it lets you see what type a parameter is expecting etc.

    $ Get-ChildItem -
    Path                 Depth                File                 ErrorAction    
    
    [string[]] Path

Re: Nushell: Introduction to a new kind of shell

#237

Earlier quoted context omitted.

I'm one of the Nushell developers, and one of the main reasons I joined the project was that I couldn't find a cross-platform shell I was happy with. PowerShell has a _lot_ of baggage. I don't like a lot of their design decisions (ex: the super verbose naming, the continue-on-error default that makes scripting a pain), and it's unlikely that those decisions will ever be revisited. I tried pretty seriously to use Powe…

> the super verbose naming Isn’t long names but short aliases the pragmatic way of solving the naming problem? “ls” or “dir” is perfect when typing interactive but in a long program I don’t mind typing something longer out. Startup perf is definitely an issue but otoh that doesn’t feel like a design decision that couldn’t be fixed.

But then you have 2 names to remember.

PowerShell's approach to naming is divisive. I'm not saying it's objectively bad, but I'm in the camp that doesn't like it.

Re: Nushell: Introduction to a new kind of shell

#238

Just was trying it. A couple minutes in, I discovered it doesn't support suspended jobs. :( seems like that would be a very basic feature. https://github.com/nushell/nushell/issues/1329 https://github.com/nushell/nushell/issues/1796 https://github.com/nushell/nushell/discussions/5239

In the past, I've toured these alternate, non-POSIX shells like Nushell. A lot of them (e.g. Powershell, Elvish) don't provide job control. I looked into how job control works and it's kind of a bother, so I see why they might have elided it. I wonder if multiplexing the terminal using tmux or screen is a good enough alternative the job control for many use-cases. You do lose state (i.e. environment variables, workin…

Sorry, but you're incorrect here. PowerShell does most definitely provide job control.

    Get-Help about_Jobs
Alternatively, online documentation from Microsoft regarding jobs: https://learn.microsoft.com/en-us/powershell/module/microsof...

Re: Nushell: Introduction to a new kind of shell

#239
post #133

I still believes that [xonsh]( https://xon.sh/ ) is the best of its kind because I do not want to remember yet another language syntax

Is there something like this but with Lua?

There was an attempt: http://lua-users.org/wiki/LuaShell

Re: Nushell: Introduction to a new kind of shell

#240

Earlier quoted context omitted.

Well I actually use zsh (I always mean to switch to oil though), and.. in zsh, you don't need to quote variables? Are you sure? Oh.. I just tested here. It works! $ mkdir -p /q/a\ b/x $ a="a b" $ ls /q/$a x And in bash: $ a="a b" $ ls /q/$a ls: cannot access '/q/a': No such file or directory ls: cannot access 'b': No such file or directory The weird thing is, my shell is zsh but my shell scrip ts are all either #!/bi…

The only thing to keep in mind about Zsh parameter expansion is that unquoted empty values will be dropped entirely, while quoted empty values will be treated like the empty string '': show_nargs() { print $# } q= show_nargs $q # 0 show_nargs "$q" # 1 So it doesn't completely solve the need for defensive quoting, but at least it mitigates the need for the most part.

Ouch, that is a sharp corner:

    $ echo 'aaa' > a.txt
    $ echo 'bbb' > b.txt
    $ TMP_DIR="" # Mistake! Missing arg, failed search, typo'd name, etc.
    $ cp a.txt b.txt $TMP_DIR
    $ cat b.txt
    aaa
    $ # The contents of b.txt are lost.
Post reply on HN