On Wed, Mar 26, 2025 at 12:19:48PM +0100, Andreas Schwab wrote:
> On Mär 26 2025, Léa Gris wrote:
> 
> > Even though LC_NUMERIC=C is used to correctly parse 3.141592654, the
> > expansion of $LC_NUMERIC still prints its original value (fr_FR.UTF-8).
> 
> That is expected.  The reference to LC_NUMERIC is expanded before the
> command execution is started (which includes putting LC_NUMERIC=C in the
> temporary environment for the command).
> 
> -- 
> Andreas Schwab, SUSE Labs, sch...@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

The argument to "bash -c" is a single-qouted string though, so the shell
would not expand the variable.

On my Alpine system (bash 5.3.37), LC_NUMERIC is unset, and setting
LC_ALL does not automagically set LC_NUMERIC in "bash -c":

        % LC_ALL=C bash -c 'echo "$LC_NUMERIC"'
        (blank line output)

        % LANG=C bash -c 'echo "$LC_NUMERIC"'
        (blank line output)



-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.

Reply via email to