Re:The temptation of writing shell scripts, illustrated
by ilyash on Sunday April 24, 2022 @04:39AM
(#31142262)
It is now the niche of Next Generation Shell. Totally not humble and biased opinion... maybe. I'm the author. You are very welcome to make your own judgement - https://ngs-lang.org/
Re:The temptation of writing shell scripts, illustrated
by tux2bsd on Sunday April 24, 2022 @07:09AM
(#31142943)
Your examples are nice and clear, many projects could learn from you.
Re:The temptation of writing shell scripts, illustrated
by ilyash on Sunday April 24, 2022 @09:07AM
(#31143587)
Thank you! I was thinking to add some code snippets on the website. Other projects do that and I think it gives you the "feel" pretty quickly.
Re:The temptation of writing shell scripts, illustrated
by tux2bsd on Saturday April 30, 2022 @02:52AM
(#31213957)
I loathe nearly all man pages, they are written in a manner that is as over the top and an absolute chore to digest. I believe it is a form on programmer one-upmanship, it is largely unnecessary and stalls common usage massively.
I made this recently and tried very hard to make it so that the vast majority of people that could use the command line could grasp what it did, usage is trivial:
https://github.com/tux2bsd/freebsd-update-probe
I guess what I'm saying is I like documentation written for humans (which you do).
Re:The temptation of writing shell scripts, illustrated
by ilyash on Wednesday May 04, 2022 @09:33PM
(#31268290)
I guess that's what's called "for humans".
Thanks!
Re:The temptation of writing shell scripts, illustrated
by knazarov on Sunday April 24, 2022 @07:39AM
(#31143101)
I’m excited to see that your project is maturing. Good luck!
Re:The temptation of writing shell scripts, illustrated
by ilyash on Sunday April 24, 2022 @09:06AM
(#31143584)
Thanks!
Re:The temptation of writing shell scripts, illustrated
by VariableStar on Sunday April 24, 2022 @04:24AM
(#31142205)
Yes, Perl is still used and it is fast and excellent for anything that becomes too big or complicated for a shell or awk script. As you write it is installed in the vast majority of *NIXes as default.
Re:The temptation of writing shell scripts, illustrated
by lightbulbjim on Sunday April 24, 2022 @04:23AM
(#31142200)
Ruby makes for a good “super shell” script too.
Re:The temptation of writing shell scripts, illustrated
by viraptor on Sunday April 24, 2022 @09:40AM
(#31143892)
And if you're conflicted between thinking both this and "but go is nice and static and free of runtime", you can look at https://crystal-lang.org/ Ruby syntax with static compilation for your tools.
Re:The temptation of writing shell scripts, illustrated
by boesboes on Sunday April 24, 2022 @08:35AM
(#31143411)
Definitly. I've been replacing some of my more janky & complex bash scripts with ruby and it becomes a lot cleaner imo. Also, I recently 'discovered' Pathname, it takes away a lot of the pain of dealing with files and directories in ruby and allows for pretty clean code imo.
Re:The temptation of writing shell scripts, illustrated
by contingencies on Sunday April 24, 2022 @03:48AM
(#31142057)
perl 5 was great but it broke down as soon as you needed a depth or complexity of data structure. The number of times you had to man perldsc ... every single one had a different syntax for declaration and dereferencing ... AoAoHoHoAARGH!
Re:The temptation of writing shell scripts, illustrated
by ryl00 on Sunday April 24, 2022 @08:30AM
(#31143390)
I have the opposite problem... I find perl's data structures so ridiculously easy to write that I can quickly build up arrays of hashes of arrays of (ad infinitum) while in the "flow". Throw in the ability to actually get references to things, and control de-referencing of things, and I've never felt perl has stopped me (for better or worse!) from doing anything with data structures.
Re:The temptation of writing shell scripts, illustrated
by zengargoyle on Sunday April 24, 2022 @08:33AM
(#31143401)
$ perl -E 'my $f=[[{X=>{Y=>["FOO"]}}]]; say $f->[0][0]{X}{Y}[0];my $g=$f->[0][0]{X}{Y}; say $g->[0]'
FOO
FOO
Seems pretty trivial.
Re:The temptation of writing shell scripts, illustrated
by contingencies on Sunday April 24, 2022 @08:57AM
(#31143513)
Yeah now try iterating. What used to get me is for some types $ is used only when de-referencing. It was terrible trying to track those errors down. Basically I loved perl but the language has a terrible design, inexcusable really. There was essentially no point in having types, it took all the worst parts of C and then reinvented them slightly differently with new syntax, twice per datatype. Glad to be rid of it.
> Python, Go and so on need more structure and often don't have quite as simple and convenient methods of doing various shell like things.
This is Perl's niche, or at least it was Perl's first niche before it started getting used for CGI. The things you'd do in a shell script are generally convenient in Perl too, the main inconvenient part is selecting from the many different ways to invoke a program in Perl, like system(), backticks, qx//, open(), etc.
Perl is also more commonly installed and has faster startup time than Python, in my experience.