lynx-dev
[Top][All Lists]
Advanced

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

Re: [Lynx-dev] shell stuff


From: Thomas Dickey
Subject: Re: [Lynx-dev] shell stuff
Date: Sun, 21 Jan 2024 20:09:49 -0500

On Sun, Jan 21, 2024 at 07:06:45PM +0000, Thorsten Glaser wrote:
> Hi,
> 
> while scrolling through a diff to see if I can find the cause
> of a regression, I saw this (pasting only one example of it):
> 
> 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 :-)
 
> Since you never need to quote a command substitution in scalar
> context (assignment RHS), this can be easily fixed:
> 
> source=`echo "$source" | sed -e 's%/$%%'`/
> 
> 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"?

(that wouldn't work with Solaris 10 - my build-log for that worked)

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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