I must have died and gone to heaven [nushell]
from phantomwise@lemmy.ml to linux@lemmy.ml on 15 Sep 10:45
https://lemmy.ml/post/36178057

I’ve been trying nushell and words fail me. It’s like it was made for actual humans to use! 🤯 🤯 🤯

It even repeats the column headers at the end of the table if the output takes more than your screen…

Trying to think of how to do the same thing with awk/grep/sort/whatever is giving me a headache. Actually just thinking about awk is giving me a headache. I think I might be allergic.

I’m really curious, what’s your favorite shell? Have you tried other shells than your distro’s default one? Are you an awk wizard or do you run away very fast whenever it’s mentioned?

nushell giving nice table outputs to `ls | where type == symlink | sort-by modified` and `ps | where mem > 200MB | sort-by name`

#linux

threaded - newest

DasFaultier@sh.itjust.works on 15 Sep 10:58 next collapse

(…) 'cause it was quarter part eleven

on a Saturday in 1999

🎶🎶

To answer your questions, I work on the Bash, because it’s what’s largely used at work and I don’t have the nerve to constantly make the switch in my head. I have tried nushell for a few minutes a few months ago, and I think it might actually be great as a human interface, but maybe not so much for scripting, idk.

Sxan@piefed.zip on 15 Sep 11:19 next collapse

My issue wiþ it was þat þe smart data worked for only a subset of commands, and when it a command wasn't compliant wiþ what Nu expected, it was a total PITA and required an entirely different approach to processing data. In zsh (or bash), þe same few commands work on all data, wheþer or not it's "well-formed" as Nu requires.

Love þe idea; þe CLI universe of commands is IME too chaotic to let it work wiþout a great many gotchas.

otp@sh.itjust.works on 15 Sep 11:51 next collapse

Love þe idea

Wouldn’t that be a different character because it’s a voices th? Usually that character represents a voiceless th.

Sxan@piefed.zip on 15 Sep 12:14 collapse

In Icelandic, yes. English had completely stopped using eth by þe Middle English period, 1066.

Ferk@lemmy.ml on 15 Sep 13:18 collapse

Didn’t they also stop using the þ in Modern English?

Why use þ (Þ, thorn) but not ð (Ð, eth)? …and æ (Æ, ash) …might as well go all the way if you want to type like that.

TrickDacy@lemmy.world on 15 Sep 12:46 next collapse

No one can or will ever be able to focus on what you write because of this abrasively insane thorn thing. Maybe find a better way of getting attention?

Ferk@lemmy.ml on 15 Sep 13:32 collapse

I agree completely with that sentiment, I had the same problem, the output of most commands was interpreted in a way that was not compatible with the way Nu structures data and yet it still rendered as if it were a table with 1 single entry… it was a bit annoying.

Overspark@piefed.social on 15 Sep 12:32 collapse

It's arguably better as a scripting language than as an interactive shell. There are a lot of shell scripts out there that also dabble in light data processing, and it's not the easiest thing to achieve well or without corner cases. So nu scripts are great if all you need is shell scripts with some data processing.

nu as an interactive shell is great for the use cases it shines at (like OP's example), but a bit too non-POSIXy for a lot of people, especially since it's not (yet) as well polished as something like fish is for example.

Edit to add that nu's main drawback for scripting currently is that the language isn't entirely stable yet, so you better be prepared to change your scripts as required to keep up with newer nu versions (they're at 0.107 for a reason).

calliope@retrolemmy.com on 15 Sep 11:06 next collapse

I use zsh, mainly because I’ve been using it for a really long time and it felt like an upgraded bash.

I also have used fish a tiny amount and like the idea but zsh just works for my purposes and I already know how it works.

nushell looks really cool though!

I don’t have much occasion to use awk any more but it can be really useful!

phantomwise@lemmy.ml on 15 Sep 11:25 collapse

I’ve also been using zsh until now, it’s clear it’s a massive improvement over bash. No more accidentally pasting code into the terminal!

I wasn’t even looking for a new interactive shell, zsh is fine, I was looking for a new language for shell scripts because I’m tired of bash’s legacy quirks… but the interactive nushell was too cool to resist!

calliope@retrolemmy.com on 15 Sep 13:24 collapse

nushell seriously looks amazing for working with data. I gotta remember it exists the next time I’m doing stuff like this.

It seems like a nice shell to have around and usable for cases like this regardless!

syklemil@discuss.tchncs.de on 15 Sep 11:09 next collapse

I’ve been using fish (with starship for prompt) for like a year I think, after having had a self-built zsh setup for … I don’t know how long.

I’m capable of using awk but in a very simple way; I generally prefer being able to use jq. IMO both awk and perl are sort of remnants of the age before JSON became the standard text-based structured data format. We used to have to write a lot of dinky little regex-based parsers in Perl to extract data. These days we likely get JSON and can operate on actual data structures.

I tried nu very briefly but I’m just too used to POSIX-ish shells to bother switching to another model. For scripting I’ll use #!/bin/bash with set -eou pipefail but very quickly switch to Python if it looks like it’s going to have any sort of serious logic.

My impression is that there’s likely more of us that’d like a less wibbly-wobbly, better shell language for scripting purposes, but that efforts into designing such a language very quickly goes in the direction of nu and oil and whatnot.

phantomwise@lemmy.ml on 15 Sep 11:31 next collapse

That’s interesting I hadn’t thought about the JSON angle! Do you mean that you can actually use jq on regular command outputs like ls -l?

Oil is an interesting project and the backward compatibility with bash is very neat! I don’t see myself using it though, since it’s syntax is very close to bash on purpose I’d probably get oil syntax and bash syntax all mixed up in my head and forget which is which… So I went with nushell because it doesn’t look anything like bash. If you know python what do you think about xonsh? I

syklemil@discuss.tchncs.de on 15 Sep 12:56 collapse

That’s interesting I hadn’t thought about the JSON angle! Do you mean that you can actually use jq on regular command outputs like ls -l?

No, you need to be using a tool which has json output as an option. These are becoming more common, but I think still rare among the GNU coreutils. ls output especially is unparseable, as in, there are tons of resources telling people not to do it because it’s pretty much guaranteed to break.

elmicha@feddit.org on 15 Sep 16:14 collapse

There’s jc (CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries).

cyrl@lemmy.world on 15 Sep 21:19 collapse

You’ve opened a rabbit hole I know I’m just going to fall down… thanks netizen!

Overspark@piefed.social on 15 Sep 12:29 collapse

nu 's commands also work on JSON, so you don't really need jq (or xq or yq) any more. It offers a unified set of commands that'll work on almost any kind of structured data.

MonkderVierte@lemmy.zip on 15 Sep 11:11 next collapse

Why not parse ls (and what to do instead)?

phantomwise@lemmy.ml on 15 Sep 12:04 next collapse

I feel my sanity slowly slipping away while reading…

MonkderVierte@lemmy.zip on 15 Sep 14:56 collapse

Yeah, why are linebreaks & co. in names even allowed on file system level? There’s not even something like a restricted mode mount option for most fs.

Oinks@lemmy.blahaj.zone on 15 Sep 16:21 next collapse

There’s an argument to be made that system software like filesystems and kernels shouldn’t get too smart about validating or transforming strings, because once you start caring about a strings meaning, you can no longer treat it as just a byte sequence and instead need to worry about all the complexities of Unicode code points. “Is this character printable” seems like a simple question but it really isn’t.

Now if I were to develop a filesystem from scratch, would I go for the 80% solution of just banning the ASCII newline specifically? Honestly yes, I don’t see a downside. But regardless of how much effort is put into it, there will always be edge cases – either filenames that break stuff, or filenames that aren’t allowed even though they should be.

MonkderVierte@lemmy.zip on 15 Sep 17:30 collapse

Oh right, filesystem is initialized before charset & stuff. My bad.

thetaT@hexbear.net on 15 Sep 18:15 collapse

because why not? it’s just characters and any UTF8 string is allowed as a filename so long as it doesn’t contain a null byte. people’s usecases are different, and you really shouldn’t be parsing ls output in the first place

Oinks@lemmy.blahaj.zone on 15 Sep 12:21 collapse

The usual problems with parsing ls don’t happen here because Nu’s ls builtin returns properly typed data. You can work with it in pretty much the same way you would work with it in Python, except that Nu has a composition operator that doesn’t suck ass (|), so you don’t have to write as much imperative boilerplate.

I have a number of reservations regarding Nu (the stability of the scripting language, unintuitive syntax rules, a disappointing standard library) but this particular argument just doesn’t apply.

drspod@lemmy.ml on 15 Sep 13:34 collapse

The usual problems with parsing ls don’t happen here because Nu’s ls builtin returns properly typed data.

Isn’t that the point that the previous commenter was making by linking that answer? I read their comment as “here is why you should use Nu shell instead of parsing ls output.”

black_flag@lemmy.dbzer0.com on 15 Sep 11:13 next collapse

Nushell is great, I should use it again. Gave up on it after I wrote a thing for converting fish completions to their autocomplete system for it and their internal autocomplete didn’t perform anywhere nearly adequately.

Overspark@piefed.social on 15 Sep 12:37 collapse

Check out carapace. It takes a bit of setup but basically tries to make all the completions work in almost any shell. For me that solved the big step backwards from fish's completions that nu's native completions have.

black_flag@lemmy.dbzer0.com on 15 Sep 16:30 collapse

Yeah, that’s what I’ll do when I get around to checking it out again.

ArseAssassin@sopuli.xyz on 15 Sep 11:16 next collapse

Love nushell. It’s just about the most practical functional programming language I’ve ever had the pleasure of using.

I’m using fish as my default shell since it’s more standards-compliant and plays nicer with tools that modify your environment. But any time I need to do more complicated shell scripting, I’m breaking out nushell.

Ferk@lemmy.ml on 15 Sep 11:23 next collapse

I prefer getting comfortable with bash, because it’s everywhere and I need it for work anyway (no fancy shells in remote VMs). But you can customize bash a lot to give more colored feedback or even customize the shortcuts with readline. Another one is pwsh (powershell) because it’s by default in Windows machines that (sadly) I sometimes have to use as VMs too. But you can also install it in linux since it’s now open source.

But if I wanted to experiment personally I’d go for xonsh, it’s a python-based one. So you have all the tools and power of python with terminal convenience.

phantomwise@lemmy.ml on 15 Sep 12:00 collapse

Yeah if you need to work on machines with bash it makes sense to stick with it. Sorry you have to work on Windows… how is powershell compared to bash?

I don’t know python but xonsh seems really cool, especially since like nushell it works on both linux and windows so you don’t have to bother about OS specific syntax

Ferk@lemmy.ml on 15 Sep 12:54 collapse

powershell, in concept, is pretty powerful since it’s integrated with C# and allows dealing with complex data structures as objects too, similar to nushell (though it does not “pretty-print” everything the way nushell does, at least by default).

But in practice, since I don’t use it as much I never really get used to it and I’m constantly checking how to do things… I’m too used to posix tools and I often end up bringing over a portable subset of msys2, cygwin or similar whenever possible, just so I can use grep, sed, sort, uniq, curl, etc in Windows ^^U …however, for scripts where you have to deal with structured data it’s superior since it has builtin methods for that.

LaggyKar@programming.dev on 15 Sep 11:51 next collapse

Looks like it’s taken a page from PowerShell in passing structured data rather than just text.

Overspark@piefed.social on 15 Sep 12:35 next collapse

Yeah, it has. I think they started out as loving the concepts of PowerShell but hating the implementation, combined with the fact that PowerShell is clearly a Windows-first shell and doesn't work so well on other OSes (it surprised me a lot to find out that PowerShell even has support for linux).

nu tries to implement these concepts in a way that's more universal and can work equally well on Linux, macOS or Windows.

ReluctantMuskrat@lemmy.world on 15 Sep 13:09 collapse

Powershell works really well on other OSs now. I use it on MacOS and Linux daily. I might loath MS but Powershell is a fantastic shell and after working with an object-oriented shell I hate going back to anything else.

phantomwise@lemmy.ml on 15 Sep 12:44 collapse

Oh I didn’t know powershell did that too! It sure beats endless parsing errors

sunbeam60@lemmy.ml on 15 Sep 16:30 collapse

That was the foundational concept in powershell; everything is an object. They then went a ruined it with insane syntax and a somewhat logical, but entirely in practiceimpractical verb-noun command structure.

Nushell is powershell for humans. And helps that it runs across all systems. It’s one of the first things I install.

Ephera@lemmy.ml on 15 Sep 19:43 collapse

somewhat logical, but entirely in practice verb-noun command structure.

That’s supposed to be “impractical”, not “in practice”, for others reading along.

For example, the “proper” command to list a directory is: Get-ChildItem
The “proper” command to fetch a webpage is: Invoke-WebRequest https://example.com/

In these particular cases, they do have aliases defined, so you can use ls, dir and curl instead, but …yeah, that’s still generally what the command names are like.

It’s partially more verbose than C#, which is one of the most verbose programming languages out there. I genuinely feel like this kind of defeats the point of having a scripting language in the first place, when it isn’t succinct.
Like, you’re hardly going to use it interactively, because it is so verbose, so you won’t know the commands very well. Which means, if you go to write a script with Powershell, you’ll need to look up how to do everything just as much as with a full-fledged programming language. And I do typically prefer the better tooling of a full-fledged programming language…

communism@lemmy.ml on 15 Sep 11:57 next collapse

Nushell looks cool but I prefer to stick with the POSIXes so that I know my scripts will always work and syntax always does what I expect it to. I use zsh as a daily driver, and put up with various bashes, ashes, dashes, that come pre-installed with systems I won’t be using loads (e.g. temporary vms).

Aatube@kbin.melroy.org on 15 Sep 11:57 next collapse

Your scripts should have Bourne shebangs

syklemil@discuss.tchncs.de on 15 Sep 13:07 next collapse

Yeah, there should be a clear separation between scripts, which should have a shebang, and interactive use.

If a script starts acting oddly after someone does a chsh, then that script is broken. Hopefully people don’t actually distribute broken script files that have some implicit dependency on an unspecified interpreter in this day and age.

communism@lemmy.ml on 15 Sep 13:52 collapse

They have !/bin/sh shebangs. /bin/sh is a symlink, in my case to zsh. I like using one language.

ReversalHatchery@beehaw.org on 15 Sep 15:12 next collapse

then your hashbangs are bad. isn’t their point to tell the kernel exactly which interpreter can process it correctly?

Aatube@kbin.melroy.org on 15 Sep 16:06 next collapse

To be fair, I'm fairly sure the zsh interpreter has a POSIX sh mode

communism@lemmy.ml on 15 Sep 20:46 collapse

They’re posix scripts… Any posix compliant bin/sh can interpret them.

Aatube@kbin.melroy.org on 15 Sep 16:05 collapse

Hopefully you're not using the sh language—hopefully you're restraining yourself from using any of the non-POSIX extensions then

phantomwise@lemmy.ml on 15 Sep 12:15 next collapse

I don’t really mind having a non-POSIX shell since it doesn’t prevent bash scripts from working, but I get that if you want portability bash is still best since it’ll work mostly anywhere.

4am@lemmy.zip on 15 Sep 13:31 collapse

If I can shebang nutshell (assuming all the builtins from bash or even sh work) and pass a flag to remove all the fancy UI-for-humans formatting so that piped commands int eh scripts work, then I think this is incredible.

Yeah having this installed along side other more “standard” shells is fine I guess, but it looks like maybe it has some neat functionality that is more difficult in other shells? I guess I’d need to read up on it more but having a non-interactive mode for machines to read more easily would be a huge plus for it overall. I suppose that depends on what it offers/what it’s trying to accomplish.

Aatube@kbin.melroy.org on 15 Sep 16:11 collapse

The Unicode bars aren't actually stored; that's just the graphical representation of the table datatype which you can think of as JSON

rokejulianlockhart@lemmy.ml on 15 Sep 21:57 collapse

Like PowerShell does?

Aatube@kbin.melroy.org on 16 Sep 00:51 collapse

exactly

some claim that was the inspiration for nushell: powershell but less verbose and more bashy

nimpnin@sopuli.xyz on 15 Sep 13:01 next collapse

Always confuses me when people say this. You can use multiple different shells / scripting languages, just as you can use multiple programming languages.

communism@lemmy.ml on 15 Sep 13:53 next collapse

I know that. I just don’t have a use case for alternative shells. Zsh works fine for me and I know how it works. I don’t have problems that need fixing, so I don’t need to take the time to learn a new, incompatible shell.

elmicha@feddit.org on 15 Sep 16:20 next collapse

Some people work on machines where they are not allowed to install anything.

nimpnin@sopuli.xyz on 15 Sep 17:41 collapse

What does that have to do with anything?

elmicha@feddit.org on 15 Sep 23:23 collapse

You said you/I/everyone can use multiple shells, I said: no, I can’t, at least not on all the machines that I have to use.

nimpnin@sopuli.xyz on 16 Sep 08:18 collapse

at least not on all the machines that I have to use

Ok?

Ferk@lemmy.ml on 16 Sep 07:17 collapse

If you want your scripts to “always work” you’ll need to go with the most common/standard language, because the environments you work on might not be able to use all of those languages.

nimpnin@sopuli.xyz on 16 Sep 08:21 collapse

I mean if all your scripts are fully general purpose. That just seems really weird to me. I don’t need to run my yt-dlp scripts on the computational clusters I work on.

Moreover, none of this applies to the interactive use of the shell.

Ferk@lemmy.ml on 16 Sep 09:20 collapse

It’s not only clusters… I have my shell configuration even in my Android phone, where I often connect to by ssh. And also in my Kobo, and in my small portable console running Knulli.

In my case, my shell configuration is structured in some folders where I can add config specific to each location while still sharing the same base.

Maybe not everything is general, but the things that are general and useful become ingrained in a way that it becomes annoying when you don’t have them. Like specific shortcuts for backwards history search, or even some readline movement shortcuts that apparently are not standard everywhere… or jumping to most ‘frecent’ directory based on a pattern like z does.

If you don’t mind that those scripts not always work and you have the time to maintain 2 separate sets of configuration and initialization scripts, and aliases, etc. then it’s fine.

nimpnin@sopuli.xyz on 16 Sep 09:31 collapse

those scripts not always work

This feels like ragebait. I have multiple devices, use fish whenever that can be installed and zsh/bash when not, and have none of these issues.

EDIT:

or some methods to jump to most recent directory like z.

Manually downloading the same shell scripts on every machine is just doing what the package manager is supposed to do for you. I did this once to get some rust utils like eza to get them to work without sudo. It’s terrible.

Ferk@lemmy.ml on 16 Sep 09:44 collapse

Manually downloading the same shell scripts on every machine is just doing what the package manager is supposed to do for you

If you have a package manager available, and what you need is available there, sure. My Synology NAS, my Knulli, my cygwin installs in Windows, my Android device… they are not so easy to have custom shells in (does fish even have a Windows port?).

I rarely have to manually copy, in many of those environments you can at least git clone, or use existing syncing mechanisms. In the ones that don’t even have that… well, at least copying the config works, I just scp it, not a big deal, it’s not like I have to do that so often… I could even script it to make it automatic if it ever became a problem.

Also, note that I do not just use things like z straight away… my custom configuration automatically calls z as a fallback when I mistype a directory with cd (or when I intentionally use cd while in a far/wrong location just so I can reach faster/easier)… I have a lot of things customized, the package install would only be the first step.

nimpnin@sopuli.xyz on 16 Sep 10:03 collapse

So you’re willing to do a lot of manual package managing, in general put a lot of work into optimizing your workflow, adjusting to different package availability, adjusting to different operating systems…

…but not writing two different configs?

That is your prerogative but you’re not convincing me. Though I don’t think I’ll be convincing you either.

I have separate configs/aliases/etc for most of my machines just because, well, they are different machines with different hardware, software, data, operating systems and purposes. Even for those (most) that I can easily install fish on.

Ferk@lemmy.ml on 16 Sep 10:19 collapse

It’s actually the lazy way. I only work once, then copy that work everywhere. The copying/syncing is surprisingly easy. If that’s what you call “package management” then I guess doing “package management” saves a lot of work.

If I had to re-configure my devices to my liking every time I would waste time in repetition, not in an actual improvement. I configured it the way I liked it once already, so I want to be able to simply copy it over easily instead of re-writing it every time for different systems. It’s the same reason why I’ve been reusing my entire /home partition for ages in my desktop, I preserve all my setup even after testing out multiple distros.

If someone does not customize their defaults much or does not mind re-configuring things all the time, I’m sure for them it would be ok to have different setup on each device… but I prefer working only once and copying it.

And I didn’t say that bash is the only config I have. Coincidentally, my config does include a config.fish I wrote ages ago (14 years ago apparently). I just don’t use it because most devices don’t have fish so it cannot replace POSIX/Bash… as a result it naturally was left very barebones (probably outdated too) and it’s not as well crafted/featureful as the POSIX/bash one which gets used much more.

nimpnin@sopuli.xyz on 16 Sep 17:33 collapse

I only work once, then copy that work everywhere.

Good that works for you. If only my needs were so simple that the configs could be same on each machine.

paljastus

I know that’s an insufferable way to put it but holy shit have you been like that too.

MonkCanatella@sh.itjust.works on 15 Sep 15:19 collapse

I love NuShell but it is annoying when using LLMs to generate troubleshooting code.

Cat_Daddy@hexbear.net on 15 Sep 12:42 next collapse

I’ve had nushell as my daily driver for a couple years now and I love it. “Made for actual humans to use” is exactly the description I’d give.

bastion@feddit.nl on 15 Sep 14:15 next collapse

I like nushell, but I love xonsh. Xonsh is the bastard love child of Python and Bash.

it can be thought of as:

  • try this statement in Python
  • if there’s an exception, try it in bash.

Now, that’s not a very accurate description, because the reality is more nuanced, but it allows for things like:

for file in !(find | grep -i '[.]mp3^'):
    file = Path(file.strip())
    if file != Path('.') and file != file.with_suffix('.mp3'):
    mv @(file) @(file.with_suffix('.mp3'))

Now, there are things in there I wouldn’t bother with normally - like, rather than using mv, I’d just use file.rename(), but the snippet shows a couple of the tools for interaction between xonsh and sh.

  • !(foo) - if writing python, execute foo, and return lines
  • @(foo) - if writing sh, substitute with the value of the foo variable.

But, either a line is treated in a pyhony way, or in a shelly way - and if a line is shelly, you can reference Python variables or expressions via @(), and if it’s Pythony, you can execute shell code with !() or $(), returning the lines or the exact value, respectively.

Granted, I love python and like shell well enough, and chimeras are my jam, so go figure.

MonkCanatella@sh.itjust.works on 15 Sep 15:15 next collapse

Does this offer anything of pure python?

bastion@feddit.nl on 15 Sep 17:35 collapse

It’s a superset of python, so valid python should run fine. Imports into your shell are doable, too – for example, I import path.Path in my xonshrc, so it’s always available when I hit the shell. I don’t often have to use Path, because regular shell commands are often more straightforward. But when I do, it’s nice to have it already loaded. Granted, that could get kooky, depending on what you import and execute.

You can associate/shebang Xonsh with .xsh files, or run “xonsh foo.xsh” - and that works like “bash foo.sh” would, except using xonsh syntax, of course.

It’s not Bash compatible - copypasta of scripts may not work out. But it’s a good shell with some typical shell semantics.

there are some great plugins, too - like autovox, which allows you to create python venvs associated with specific subfolders. so, cd myproject does the equivalent of cd myproject; . path/to/venv/bin/activate.

overall, there definitely is some jank, but it’s a great tool and I love it.

MonkCanatella@sh.itjust.works on 16 Sep 16:43 collapse

Hm. That sounds delightful. I do think once your script hits a not one liner level of complexity, python is a logical next step.

Does it provide any useful stuff to Python itself? Would I like, derive any benefit to writing a script in xonsh over pure python?

priapus@piefed.social on 15 Sep 21:03 collapse

Xonsh is also a really cool option. If I used Python more regularly and was more comfortable using it without having to look stuff up, I'd probably use it over Nushell.

bastion@feddit.nl on 15 Sep 21:57 collapse

Yeah, I think if I wasn’t familiar with Python, it’d be nushell all the way.

Obin@feddit.org on 15 Sep 15:37 next collapse

I’m really curious, what’s your favorite shell?

Emacs eshell+eat

It essentially reverses the terminal/shell relationship. Here, it’s the shell that starts a terminal session for every command. Eshell is also tightly integrated with Emacs and has access to all the extended functionality. You can use Lisp in one-liners, you can pipe output directly to an emacs buffer, you can write custom commands as lisp functions, full shortcut customization not limited to terminal keys, history search via the completion framework (i.e. consult-history), easy prompt customization, etc.

There’s also Tramp, which lets you transparently cd into remote hosts via ssh, docker containers, SMB/NFS-shares, archive files, and work with them as if they were normal directories (obviously with limited functionality in some cases, like archives).

And probably a lot of stuff I’m missing right now.

Fontasia@feddit.nl on 15 Sep 16:59 next collapse

That looks a lot like PowerShell

underscores@lemmy.zip on 15 Sep 19:54 collapse

PowerShell without the awful syntax

brianary@lemmy.zip on 16 Sep 02:38 collapse

What awful syntax?

Ffs bash uses echo “${filename%.*}” and substring=${string:0:5} and lower=“${var,}” and title=“${var^}” &c. It doesn’t use $ for assignment, only in expressions.

ronigami@lemmy.world on 15 Sep 17:14 next collapse

Until you discover nushell’s (lack of) quoting rules

kureta@lemmy.ml on 15 Sep 19:31 collapse

Can you elaborate?

ronigami@lemmy.world on 15 Sep 20:05 collapse

Last I checked, there was no rigorous system for how quoting worked, such as how to escape a quote inside a string.

bastion@feddit.nl on 15 Sep 17:37 next collapse

thanks, good thread.

KSPAtlas@sopuli.xyz on 15 Sep 17:48 next collapse

I’ve used nushell for several months, and it really is an amazing shell

It feels more like an actual language than arcane runes, and I can easily makes chains and pipelines and things that would be difficult in bash

Additionally, it makes a pretty good scripting language

beeng@discuss.tchncs.de on 15 Sep 20:50 next collapse

So you drive daily with nushell and then script in bash for portability?

Sounds not bad actually…

priapus@piefed.social on 15 Sep 21:01 next collapse

I love Nushell, it's so much more pleasant for writing scripts IMO. I know some people say they'd just use Python if they need more than what a POSIX shell offers, but I think Nushell is a perfect option in between.

With a Nushell scripts you get types, structured data, and useful commands for working with them, while still being able to easily execute and pipe external commands. I've only ever had two very minor gripes with Nushell, the inability to detach a process, and the lack of a -l flag for cp. Now that uutils supports the -l flag, Nushell support is a WIP, and I realized systemd-run is a better option than just detaching processes when SSHd into a server.

I know another criticism is that it doesn't work well with external cli tools, but I've honestly never had an issue with any. A ton of CLI tools support JSON output, which can be piped into from json to make working with it in Nushell very easy. Simpler tools often just output a basic table, which can be piped into detect columns to automatically turn it into a Nushell table. Sometimes strange formatting will make this a little weird, but fixing that formatting with some string manipulation (which Nushell also makes very easy) is usually still easier than trying to parse it in Bash.

apt_install_coffee@lemmy.ml on 16 Sep 01:26 next collapse

I used nushell for a good 6 months, it was nice having structured data, but the syntax difference to bash which I use for my day job was just too jarring to stick with.

Fish was (for me) the right balance of nice syntactic sugar and being able to reasonably expect a bash idiom will work.

[deleted] on 16 Sep 01:33 next collapse

.

[deleted] on 16 Sep 01:45 next collapse

.

h4x0r@lemmy.dbzer0.com on 16 Sep 02:00 next collapse

Formatting doesn’t like my input for some reason so I am just going to shorten it to ls -ltc | grep ‘>’.

GooseFinger@sh.itjust.works on 16 Sep 04:06 next collapse

I’m an absolute Linux tard, so it’s hilarious to me trying to read and understand most of these comments

UltraGiGaGigantic@lemmy.ml on 17 Sep 08:20 collapse

Everyone was a newbie at one point

DieserTypMatthias@lemmy.ml on 16 Sep 09:39 next collapse

Fish is great.

Magnum@lemmy.dbzer0.com on 16 Sep 13:25 collapse

Sorry I am vegan

dessalines@lemmy.ml on 17 Sep 02:36 collapse

Vegans can use fish, as long as they don’t bash

JackbyDev@programming.dev on 17 Sep 02:46 collapse

I feel like if I was forced to use PowerShell I’d fall in love with it and want to use it on Linux. Passing objects between commands instead of text sounds amazing. So many (Linux) shell commands use slightly differently shaped text, it’s annoying. New line separated? Tab separated? Null separated? Comma separated? Multiple fields? JSON? And converting between them all and using different flags to accept different ones is just such a headache.

brax@sh.itjust.works on 17 Sep 11:53 next collapse

PowerShell’s import-csv and export-csv are too dang powerful. Doing batch processing in PS is so cool.

djehuti@programming.dev on 17 Sep 13:19 collapse

I was under the impression that it was available on Linux?

JackbyDev@programming.dev on 17 Sep 15:50 collapse

It is, but I know myself and realistically unless I’m forced to learn it in an environment where it’s first class I’m not going to use it on a regular basis.