Re: use of "build.sh -B BUILDID".... with patch and more questions

"Greg A. Woods" <[email protected]> Mon, 08 Dec 2025 01:12:27 -0800
Newsgroups gmane.os.netbsd.current,gmane.os.netbsd.devel.toolchain
Organization Planix, Inc.
Message-ID <[email protected]>
--pgp-sign-Multipart_Mon_Dec__8_01:12:24_2025-1
Content-Type: text/plain; charset=US-ASCII

At Mon, 8 Dec 2025 06:51:51 +0000 (UTC), RVP <[email protected]> wrote:
Subject: Re: use of "build.sh -B BUILDID".... with patch and more questions
>
> On Fri, 5 Dec 2025, Jarle Greipsland wrote:
>
> >  val=${val#"${val%%[![:blank:]]*}"}
> >  val=${val%"${val##*[![:blank:]]}"}
> >
>
> Yes! More people should stash this in their shell tips-'n-tricks collection.
> I think you can get rid of the `"'. I have:
>
> ```
> $ cat /mnt/bak/sdf/tmp/fbsd/tt.txt
> [...]
> - Remove leading zeros from a variable:
> $ v=${v#${v%%[!0]*}}; v=${v:-0}
>
> - Remove leading blanks (may leave `v' empty if `v' is all blanks):
> $ v=${v#${v%%[![:blank:]]*}}
>
> - Remove trailing blanks (may also result in an empty `v'):
> $ v=${v%${v##*[![:blank:]]}}
> [...]

Awesome!

Remember though that pdksh, including NetBSD ksh(1) (and OpenBSD ksh and
mksh) don't (yet) implement character classes for patterns, so you have
to replace the '[:blank:]' part with '" 	"' (space and tab,
probably with the double quotes).


--
					Greg A. Woods <[email protected]>

Kelowna, BC     +1 250 762-7675           RoboHack <[email protected]>
Planix, Inc. <[email protected]>     Avoncote Farms <[email protected]>

--pgp-sign-Multipart_Mon_Dec__8_01:12:24_2025-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Content-Description: OpenPGP Digital Signature

-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRuK6dmwVAucmRxuh9mfXG3eL/0fwUCaTaWewAKCRBmfXG3eL/0
f9BUAJ9ftAoopvt5D6OBu/LNanmuPsHgkgCgq+wCY7Mlj9CaKAbPL0gbwUbUo80=
=QrF0
-----END PGP SIGNATURE-----

--pgp-sign-Multipart_Mon_Dec__8_01:12:24_2025-1--