help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: any plans for command substitution that preserves trailing newlines?


From: Christoph Anton Mitterer
Subject: Re: any plans for command substitution that preserves trailing newlines?
Date: Wed, 26 Jan 2022 22:33:52 +0100
User-agent: Evolution 3.42.2-1

On Wed, 2022-01-26 at 14:53 -0500, Chet Ramey wrote:
> I suppose you can get away without doing it, as long as you pay
> attention
> to which of those variables are exported (and so affect other
> processes'
> locale state) and which are not and affect only the shell, and make
> sure
> that the internal and external state is consistent before and after
> you
> do your thing. Bash will reset the state properly for you, but you
> don't
> know what other implementations will do.

Sorry but I still don't get it.

>From how you write it sounds as if setting LC_ALL to some value would
also actually set the values of other LC_* ?

But that doesn't seem to be mandated by POSIX:
"LC_ALL
    This variable shall determine the values for all locale categories.
The value of the LC_ALL environment variable has precedence over any of
the other environment variables starting with LC_ (LC_COLLATE,
LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) and the LANG
environment variable."

Neither does bash seem to set/reset anything (regardless of exported or
not):

$ set | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8
*$ env | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8
$ 
$ LC_ALL=C
$ set | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8
LC_ALL=C
$ env | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8
$ export LC_ALL
$ env | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8
LC_ALL=C
$ unset LC_ALL 
$ set | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8
$ env | grep -E '^(LANG|LC_)'
LANG=en_UK.UTF-8



Thanks,
Chris.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]