emptyother,
@emptyother@programming.dev avatar

Powershell for those that don’t like powershell. Good. Pwsh need some competition in the object-piping category.

hallettj,
@hallettj@beehaw.org avatar

Well I might be hooked. It didn’t take me long to reproduce the niceties in Nushell I’m used to from my zsh config. Some of the important parts were setting up zoxide with a key binding for interactive mode, switching on vi key bindings, setting up my starship prompt.

Home Manager is preconfigured for the above integrations which made things easier.

One feature that is missing that I like to use is curly brace expansion to produce multiple arguments. For example,


<span style="color:#323232;">$ mv *.{jpg,jpeg}
</span>

Unless there is a way to do something like this in Nushell that I haven’t seen yet?

Something I enjoyed was automating a sequence of steps I’ve been running a lot lately due to a program that often partially crashes,


<span style="color:#323232;">def nkill [name_substring] {
</span><span style="color:#323232;">  ps | where name =~ $name_substring | each { |p| kill $p.pid; $p }
</span><span style="color:#323232;">}
</span>

I realized after writing this that I basically recreated killall -r. But it’s nice that it was so easy to make a custom command to do a very specific thing. And my version gives me a nice report of exactly what was killed.

Thanks for making this post OP! When I’ve heard mentions of Nushell I’m the past I think I conflated it with Powershell, and wrote it off as a Windows thing. (Maybe because it’s introduced as being “like Powershell”.) But now that I see that it’s cross-platform I’m enjoying digging into it!

tad_lispy,

One feature that is missing that I like to use is curly brace expansion to produce multiple arguments. For example,

$ mv *.{jpg,jpeg}

Maybe this will work for expansion: github.com/nushell/nu_scripts/blob/…/expand.nu

It’s in the “filesystem” section, but I think it works on any string, not only paths. See the ugly duck example. I didn’t try it myself yet.

BTW the nu_scripts goodies are available in Nixpkgs, so since you are using Home Manager, it’s easy to integrate. Take a look at my config for starters: gitlab.com/tad-lispy/…/tad.nix#L39-47

hallettj,
@hallettj@beehaw.org avatar

Thanks for the tip about nu_scripts, those look handy!

The expand command is nice. I don’t see how to use it to my mv command work. But that’s not a huge deal.

Hawk,

If you want something more Unix like and less PowerShell (but absolutely not POSIX), checkout Elvish.

eric,
@eric@lemmy.ca avatar

I liked it when I tried it but I can’t quit zsh.

FUsername,
@FUsername@feddit.de avatar

…so you’re locked in ever since? 🤪 Is it a serious case of Stockholm Syndrome or do you like it?

eric,
@eric@lemmy.ca avatar

My workflow works the best in bash/zsh shells. Shells that are too different are too much of a change. I like fish as well. Probably a touch of Stockholm Syndrome too haha

marco, (edited )
@marco@beehaw.org avatar

It’s cool, I just gave it a go, but I’m not sure it’s gonna happen that I’ll transition from

ls -lrt (this does not work in NuShell)

to

ls | sort-by modified | reverse

starman,
@starman@programming.dev avatar

Well, it’s easier to remember second script

FUsername,
@FUsername@feddit.de avatar

While your argument is valid, most bash users I know are lazy bitches and tend to alias commands which require to type more than 5 letters. I guess NuShell lower the bar for NuUsers, but of I have to remember either single letters or puppy it through longer commands, I world opt for single letters.

marco,
@marco@beehaw.org avatar

Totally - for new users it’s great… similarly, I would have loved to start typing on Dvorak.

My problem might be one of age, but there is no way I’m gonna retrain myself after 20+ years of typing that specific ls command… ;)

hallettj,
@hallettj@beehaw.org avatar

So maybe this is too much of a kludge, but I happened to see that you can define custom sub-commands to extend existing commands. You can use that to reproduce your familiar command:


<span style="color:#323232;">def "ls -lrt" [] {
</span><span style="color:#323232;">  ls | sort-by modified | reverse
</span><span style="color:#323232;">}
</span>

Of course this does not capture the usual composability of those switches.

TiphaineRupa,

Definitely an interesting project especially for those Linux users that mostly stick to one machine and like to experiment with new features.
For the regular sys admin type of person that needs to jump from one Maschine to another it’s probably a little too non-standard and hard to get productive with

dylanmorgan,

This may be the wrong place to ask, but what am I missing about shells? Other than executing commands, what do you do with them?

TiphaineRupa,

Many Linux users spend a considerable amount of time using the command line interface, so the right shell configuration can make them much more productive.

density,
@density@kbin.social avatar

The GUI is "graphical user interface". The cli is "command line interface".

In the GUI you have different DEs/DMs/WMs and people have strong feeling about them. Even though you can execute commands in all of them about equally Ya?

Well the shell is the DE for your terminal.

dylanmorgan,

Got it, I was wondering because I’m pretty comfortable using the CLI but I’ve never gotten into it at a level where the shell made a huge difference in my experience. Maybe if I was a sysadmin I’d feel differently.

density,
@density@kbin.social avatar

I got into zsh because there was all this flashy oh my zsh stuff. But I am thinking of moving back to bash, because GPL and liberty. I don't really use all the fancy zsh addons or whatever. And I don't do enough advanced scripting stuff to notice the difference. I've also heard fish has a lot of useful features.

I'm not an admin but someone else here pointed out that this would probably be a bad choice for an admin. You can't just go installing whatever toys you prefer on every system, especially if it isn't yours. An admin has to be very comfortable with standard tools. Maybe more like a developer (which I'm also not) who spends a lot of time on one system which they control.

I've been using xfce for years and I'm barely ever even tempted to give anything else a go. xfce is the perfect DE for me and I just stumbled into it. Maybe you stumbled in to your perfect shell.

starman,
@starman@programming.dev avatar

Execute complicated commands, wrire scripts, automate tasks, etc.

hallettj,
@hallettj@beehaw.org avatar

I think the best way to get an idea is to look at feature lists for fancy shells like zsh or fish. But in short there are a number of things a good shell can do to help to execute commands faster and more easily. Stuff like autocompletions which make you faster, and also make things more discoverable; fuzzy searching/matching; navigating command history; syntax highlighting which helps to spot errors, and helps to understand the syntax of the command you’re writing.

Tin,
@Tin@beehaw.org avatar

I use fish mainly just for the quality of life increase that its predictive features and command history give. I also really like that it uses functions to play the role of aliases, and it’s super easy to write and save new functions on the fly.

That said… I haven’t put in the time to really learn its nuances and I still write shell scripts using bash. Maybe I’m doing it wrong, but it works for me.

dog,

Bookmarking this.

agressivelyPassive,

NuShella. It’s right there.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines