News for hackers. Stuff that matters.
Re: by alganet on Wednesday December 21, 2022 @09:46PM (#34089094)
They mentioned "20 ways of doing things", I'm replying to that complaint.

Quoting is an issue if you don't understand the IFS and command expansion. It's an old fashioned style, but it is consistent and there's only one way of doing it (quoting every variable and subshell use).

Think of shell variables as non first-class citizens, they can only be used interpolated within a string, like "$var". The shellcheck tool enforces this perspective, which makes ' and " behave very much like python or JS.

Re: by Izkata on Wednesday December 21, 2022 @11:38PM (#34089872)
To give a more solid example, they don't understand why

  npm test
works and why they don't need

  npm "test"
Re: by alganet on Thursday December 22, 2022 @11:25AM (#34095061)
That's just lazy. How that works is on any shell man page. If you fiddle with it a little bit you figure it out:

    set -- "foo"
    echo $#
    set -- foo
    echo $#
    set -- "foo bar"
    echo $#
    set -- foo bar
    echo $#
Of course, people just want their commands to run and not learn a whole new language. Then I come back to my initial point: the language itself is small and easy to remember once you internalize it, what makes it scary is the umbrella of different command line utilities that _seems_ to be a part of the language but it's not.