Groups | Search | Server Info | Login | Register
Groups > muc.lists.netbsd.tech.toolchain > #3576
| From | "Greg A. Woods" <woods@planix.ca> |
|---|---|
| Newsgroups | muc.lists.netbsd.tech.toolchain |
| Subject | Re: use of "build.sh -B BUILDID".... with patch and more questions |
| Date | 2025-12-04 22:37 -0800 |
| Organization | Planix, Inc. |
| Message-ID | <m1vRPRn-00Mo5fC@more.local> (permalink) |
| References | <> <21226.1764899480@jacaranda.noi.kre.to> |
[Multipart message — attachments visible in raw view] - view raw
At Fri, 05 Dec 2025 08:51:20 +0700, Robert Elz <kre@munnari.OZ.AU> wrote:
Subject: Re: use of "build.sh -B BUILDID".... with patch and more questions
>
> I haven't really been following this, I'd never heard of BUILDID
> before, but:
>
> | + # remove any leading (and trailing) whitespace
> | + val=${val##*[[:blank:]]}
> | + val=${val%%*[[:blank:]]}
>
> Those don't do what you want, the first would remove everything up
> to, and including, the rightmost blank in the variable's value.
Oops! Sigh, I had only tested those with ksh, but not even properly
there it seems.
I think though I've settled on just letting the shell do it while
parsing a command line, i.e.:
var=$(echo $var)
That gets rid of extraneous duplicate whitespace between words too.
In a function taking a varname argument:
trim ()
{
local _var _val
if [ $# -ne 1 -o -z "${1}" ] ; then
echo "Usage: trim varname" >&2
return 2
fi
_var="$1"
eval _val=\"\${${_var}}\"
eval ${_var}=\$\(echo \${_val}\)
unset _var _val
}
--
Greg A. Woods <gwoods@acm.org>
Kelowna, BC +1 250 762-7675 RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Avoncote Farms <woods@avoncote.ca>
Back to muc.lists.netbsd.tech.toolchain | Previous | Next — Previous in thread | Next in thread | Find similar
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-11-30 17:46 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-12-03 10:50 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-12-04 14:45 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions Robert Elz <kre@munnari.OZ.AU> - 2025-12-05 08:51 +0700
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-12-04 22:37 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-12-04 22:49 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions Jarle Greipsland <jarle.greipsland@norid.no> - 2025-12-05 09:33 +0100
Re: use of "build.sh -B BUILDID".... with patch and more questions RVP <rvp@SDF.ORG> - 2025-12-08 06:51 +0000
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-12-08 01:12 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions Jarle Greipsland <jarle.greipsland@norid.no> - 2025-12-08 11:59 +0100
Re: use of "build.sh -B BUILDID".... with patch and more questions "Greg A. Woods" <woods@planix.ca> - 2025-12-08 17:58 -0800
Re: use of "build.sh -B BUILDID".... with patch and more questions Jarle Greipsland <jarle.greipsland@norid.no> - 2025-12-09 11:14 +0100
csiph-web