[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Consolidate recommended options?
From: |
Daniel Colascione |
Subject: |
Re: Consolidate recommended options? |
Date: |
Sun, 29 Dec 2024 15:54:05 -0500 |
User-agent: |
K-9 Mail for Android |
On December 29, 2024 3:50:36 PM EST, "Lawrence Velázquez" <vq@larryv.me> wrote:
>On Sun, Dec 29, 2024, at 3:44 PM, Daniel Colascione wrote:
>> I wonder whether it would be possible to add a simple catch-all command
>> that would encompass a set of options that can't be defaults but that
>> make writing shell scripts easier, e.g. set -euo pipefail, nullglob,
>> inherit_errexit, extglob, assoc_expand_once, and various other settings.
>>
>> It's annoying to enable all these settings individually, but enabling
>> them by default would break existing scripts. How about something like
>> "shopt -s bash2025" that would succinctly set these options all at once
>> so that script writers can more easily opt into modern behavior?
>
>No, the shell should not endorse any options like this. The
>notion that *any* of the options you mentioned is "modern" or
>even best practice is ... contentious.
>
Are you really indifferent as to whether array indexes should be evaluated once
or twice? Have you seen
https://yossarian.net/til/post/some-surprising-code-execution-sources-in-bash/?
Bash has some unfortunate unfixable defaults avoidable if you know how. Don't
you think it should be easier to avoid them? I have a hard time seeing how
anyone would choose some of these old behaviors on purpose.
Re: Consolidate recommended options?, Dale R. Worley, 2024/12/30
Re: Consolidate recommended options?, Chet Ramey, 2024/12/31