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: Zachary Santer
Subject: Re: suggestion: shell option for echo to not interpret any argument as an option
Date: Wed, 26 Jul 2023 10:15:42 -0400

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.
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.

And I'm again not receiving Greg Wooledge's emails, so I'll just respond to
that here. None of us were born knowing how to write bash scripts, sir. For
me, that's been a combination of just doing it, reading through sections of
the manual, and of course the occasional Google search leading to Stack
Overflow. Maybe not the best way to go, but it would be nice if there
weren't as many gotchas lurking about. Maybe that's just a lost cause. Noob
me would've had to have already known about this hypothetical shell option,
which of course would not have been the case.

Eh, well. Thanks, guys.

On Wed, Jul 26, 2023 at 9:24 AM Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/26/23 8:42 AM, Zachary Santer wrote:
>
> > If POSIX mandates that '--' not be taken as the end of options, then the
> > safe thing would be to simply not have echo take any options. Obviously,
> > that would break backwards compatibility, so you'd want this to be
> optional
> > behavior that the shell programmer can enable if desired.
>
> set -o posix
> shopt -s xpg_echo
>
> --
> ``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]