Re: shell stuff
Thomas Dickey <[email protected]>
| Newsgroups | gmane.comp.web.lynx.devel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]>
https://invisible-island.net
signature.asc
(application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmWtwF0ACgkQzCr0RyFn vgPB7gv+NKqrY0n1cZwZeCZwdWY/HJ4MCbhjUvTRWF4aGsMjpPidOlIVHcgg/L1E 2jkRaBf6hIf+NQTRVIC689MA8WlAk8+Ng/ypmG/hpHyDnFH50KuzhXNEyYVK5rsS vdbWXiOWYAUkSbZSbq75v9NFlzjFDjuxuTL+MDyvGmiQDGBu64RZUXwLTnuLhPx6 HHItJrnYcjDLGDaxRy+lLPrZ7oCIKuGskuMONLnKdcPWLQph8fMLg7bMbYkZUpHd tliD+yWRAgH1hnRqlAFJM6tzXU3xPjSosq3txCDeKdMP80bW3iFG9nb0wITTqnW1 j103zHfropL72uwR3NCobAFcPsgeAAVObrhMQAauoW0/nTE5p0R0+tjSY8TMS+GY LnBWa3DPmZNxa+m8rki686P9XK7MyD76r24eNY6mH0WRj8Jh7kCgDwmYeboqZ1Ce vi2rNeK5XdbzlXtJvyVhjmZOi+plRKV2AZuGLew/rhazkHx5DKHxIApDkk6RGR6q TkBJ4GoD =Tzul -----END PGP SIGNATURE-----