News for hackers. Stuff that matters.
Re:Techniques I Use to Create a Great User Experience for Sh... by tambourine_man on Saturday September 14, 2024 @11:18AM (#41540352)
Completely agree.

I have a rule that if I’m using arrays I should move to Python, PHP, etc. It’s a nice red flag. Arrays in Bash are terrible and a sign that things are getting more complicated.

Re:Techniques I Use to Create a Great User Experience for Sh... by xolox on Saturday September 14, 2024 @01:27PM (#41541276)
I use the same heuristic for when I should switch from shell to Python :-). Arrays (especially associative ones, at least for me) are a good indication that a more advanced language like Python might be more appropriate than shell.
Re:Techniques I Use to Create a Great User Experience for Sh... by ndsipa_pomu on Sunday September 15, 2024 @08:11AM (#41547021)
Akshuaaaly, I think you'll find that any BASH script uses an array for the command line arguments.

Personally, I'm fine with BASH arrays (even associative ones) and yes, the syntax can be opaque, but they get the job done. I find that the long-term advantages of BASH outweigh the many, many problems with it. (If you want something to keep running for 20 years on a variety of different machines and architectures, then BASH is easier to manage than almost any other language).

Re:Techniques I Use to Create a Great User Experience for Sh... by tambourine_man on Sunday September 15, 2024 @09:29AM (#41547388)
Command line argument parsing is already a complicated issue in Bash. It’s not a hard rule, but whenever I have to Google Bash’s array syntax I think to myself “stop it now, you’ll regret it”.