News for hackers. Stuff that matters.
Re:Filenames and Pathnames in Shell: How to Do It Correctly by doctorpangloss on Tuesday June 20, 2023 @12:57AM (#36399899)
> In my 25 years of writing shell scripts, they've nearly always been for automation on a specific OS where portability is not a concern.

I've written hundreds of scripts for Busybox for Windows (https://github.com/rmyorston/busybox-w32), Linux bash and macOS zsh. POSIX compatibility means a lot.

WRT the specific concerns of arguments: if you are doing something complicated, use Python. ChatGPT writes it better anyway.

In my experience, more complex scripting is reinventing Gradle, Ansible, Terraform, YAML & similar.

Re:Filenames and Pathnames in Shell: How to Do It Correctly by js2 on Tuesday June 20, 2023 @02:00AM (#36400280)
I write a lot of Python too. I've written whole systems in it. Been using it since 1.5.2 days. And before that Perl. I know my way pretty well around sed and awk too and pretty much the entire Unix environment.

These are all just tools. They each have their strengths and weaknesses.

There are times when shell is the best tool for the job and when it is, I prefer to use bash.

If I have to write POSIX shell because it's a constrained environment, sure, I can do it. It's just been something that's rarely been a requirement.

Re:Filenames and Pathnames in Shell: How to Do It Correctly by coldtea on Tuesday June 20, 2023 @05:23AM (#36401568)
>if you are doing something complicated, use Python. ChatGPT writes it better anyway.

Amusing that this is even a factor

Re:Filenames and Pathnames in Shell: How to Do It Correctly by lelanthran on Tuesday June 20, 2023 @05:43AM (#36401711)
> WRT the specific concerns of arguments: if you are doing something complicated, use Python.

Introducing Python syntax for this reason alone is way over-engineering your script.

Yeah, if you're doing something that requires better data structures[1] then don't use the shell, but switching to Python just to call existing programs makes things more complicated, not less.

[1] Arrays, Trees, Dictionaries, etc