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?

  • esa@discuss.tchncs.de
    link
    fedilink
    arrow-up
    40
    ·
    4 months ago

    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.mlOP
      link
      fedilink
      arrow-up
      4
      ·
      3 months ago

      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

      • esa@discuss.tchncs.de
        link
        fedilink
        arrow-up
        3
        ·
        3 months ago

        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.

  • Ferk@lemmy.ml
    link
    fedilink
    arrow-up
    18
    ·
    4 months ago

    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.mlOP
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      1
      ·
      3 months ago

      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
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        3 months ago

        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.

  • communism@lemmy.ml
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    3 months ago

    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).

    • phantomwise@lemmy.mlOP
      link
      fedilink
      arrow-up
      7
      ·
      3 months ago

      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.

      • sunbeam60@lemmy.ml
        link
        fedilink
        arrow-up
        6
        ·
        edit-2
        3 months ago

        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
          link
          fedilink
          English
          arrow-up
          2
          ·
          3 months ago

          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…

  • apt_install_coffee@lemmy.ml
    link
    fedilink
    arrow-up
    12
    ·
    3 months ago

    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.

  • DasFaultier@sh.itjust.works
    link
    fedilink
    arrow-up
    8
    ·
    4 months ago

    (…) '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.

  • black_flag@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    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.

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 months ago

    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
      link
      fedilink
      arrow-up
      2
      ·
      3 months ago

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

      • JackbyDev@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 months ago

        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.

  • h4x0r@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 months ago

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