lynx-dev
[Top][All Lists]
Advanced

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

[Lynx-dev] shell stuff


From: Thorsten Glaser
Subject: [Lynx-dev] shell stuff
Date: Sun, 21 Jan 2024 19:06:45 +0000 (UTC)

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.

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

And you might even want:

source=`echo "$source" | sed -e 's%/*/$%%'`/

bye,
//mirabilos
-- 
Gestern Nacht ist mein IRC-Netzwerk explodiert. Ich hatte nicht damit
gerechnet, darum bin ich blutverschmiert… wer konnte ahnen, daß SIE so
reagier’n… gestern Nacht ist mein IRC-Netzwerk explodiert~~~
        (as of 2021-06-15 The MirOS Project temporarily reconvenes on OFTC)



reply via email to

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