Hacker News new | ask | show | jobs
by __MatrixMan__ 856 days ago
Nushell is great fun, but be prepared to encounter and fix errors when you paste code designed for sh/bash/zsh/fish. It's a much bigger step away from convention than the others.

I think the one that catches me off guard the most is:

    export FOO=bar
    BAZ=qux
Is now

    $env.FOO = "bar"
    BAZ = "qux"
It makes more sense the nu way, but old habits die hard.
2 comments

I don't see much use for such pasting and fixing up— I generally find it more painful than other methods.

For short snippets, better to read, understand, and translate as you type.

For some shell integrations or environment setup tools, use fenv or babelfish.

For scripts of any length, just save it and run it. The shebang'll invoke bash or whatever is needed.

nushell requires double quotes around values? looks like powershell where everything-is-an-object of something-else
If you want those values to be strings, yes. For instance, it knows that this is a list of ints:

    $ [1, 2] | math max
      2
And here are some strings:

    $ ["a", "c"] | str join "b"
    abc
And there are tables

    $ [
       {name: "foo", value: 6},
       {name: "bar", value: 9}
      ] | where value > 7 | get name
    bar
And that's about as weird as the types get.