bug-bash
[Top][All Lists]
Advanced

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

Re: suggestion: shell option for echo to not interpret any argument as a


From: Chet Ramey
Subject: Re: suggestion: shell option for echo to not interpret any argument as an option
Date: Wed, 26 Jul 2023 10:51:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 7/26/23 10:15 AM, Zachary Santer wrote:
Oh, that's weird. I just assumed that sh would be running bash with 'set -o posix'. Evidently, not in MSYS2. 'man sh' takes me to the Bash man page.

Weird. I don't use MSYS2, but that's how it works on Unix/Linux systems.

When I run sh, 'set -o posix' has no effect, but it definitely makes echo not interpret any arguments as options when I'm in bash.

Not quite, at least on Unix/Linux/macOS. `set -o posix' by itself doesn't
affect echo's behavior with respect to accepting options or expanding
backslash-escapes in the remaining arguments. There's too much existing
code to try and bother with that. The `xpg_echo' shell option disables
option processing and enables backslash-escape translation, which is the
POSIX/XSI required behavior.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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