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?

  • apt_install_coffee@lemmy.ml
    link
    fedilink
    arrow-up
    17
    ·
    7 days 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.

      • brianary@lemmy.zip
        link
        fedilink
        arrow-up
        7
        ·
        6 days ago

        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.

  • priapus@piefed.social
    link
    fedilink
    English
    arrow-up
    13
    ·
    7 days ago

    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.

  • Obin@feddit.org
    link
    fedilink
    arrow-up
    11
    ·
    7 days ago

    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.

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 days 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
      ·
      5 days 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
        ·
        5 days 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.

  • KSP Atlas@sopuli.xyz
    link
    fedilink
    arrow-up
    3
    ·
    7 days ago

    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

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

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

  • esa@discuss.tchncs.de
    link
    fedilink
    arrow-up
    52
    ·
    7 days 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.

    • Overspark@piefed.social
      link
      fedilink
      English
      arrow-up
      11
      ·
      7 days ago

      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.

    • phantomwise@lemmy.mlOP
      link
      fedilink
      arrow-up
      7
      ·
      7 days 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
        ·
        7 days 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.

        • elmicha@feddit.org
          link
          fedilink
          arrow-up
          9
          ·
          7 days ago

          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
            link
            fedilink
            arrow-up
            5
            ·
            7 days ago

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