lynx-dev
[Top][All Lists]
Advanced

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

Re: [Lynx-dev] shell stuff


From: Thorsten Glaser
Subject: Re: [Lynx-dev] shell stuff
Date: Mon, 22 Jan 2024 01:25:03 +0000 (UTC)

Thomas Dickey dixit:

>> source="`echo "$source" | sed -e 's%/$%%'`/"
>>
>> You m̲u̲s̲t̲ ̲n̲o̲t̲ use double quotes both outside and inside of an
>> old-style command substitution: some shells pair them as
>> "`echo " and " | sed -e 's%/$%%'`/" instead of nesting, and
>> POSIX actively allows that.
>
>...actually the only time I've recall running into this one
>was in a bug in bash - for scripts which ran properly with
>SunOS 4 and Solaris.  SunOS 4 is out of reach now :-)

If you consider it out of reach, you can use $(…) instead of
`…` (and ${foo%bar}). People are going to want to backport,
though…

>> Can you not use source=${source%/}/ ? (Depends on where you
>> want to run that script; I know BOW’s /bin/sh fails on that
>> hard.)
>
>what is "BOW"?

https://virtuallyfun.com/2023/12/08/bsd-on-windows-things-i-wish-i-knew-existed/

Its sh choked on “if false; then : ${foo#bar}; fi” with the
most weird error messages, so merely parsing what amount of
script to skip in a nōn-executed block.

mksh now runs on BOW, so people can just use that, but it
shows up from time to time. I’ve seen some other shell, I
don’t remember which one, do that other “"`""`"” parsing,
and for a bit it was touch-and-go on that one for which
variant I’d use in mksh, as *that* one *is* permitted by
POSIX.

bye,
//mirabilos
-- 
Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.   -- Rob Pike in "Notes on Programming in C"



reply via email to

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