Groups | Search | Server Info | Login | Register


Groups > muc.lists.netbsd.tech.toolchain > #3580

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

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-08 01:12 -0800
Organization Planix, Inc.
Message-ID <m1vSXIB-00Mo5fC@more.local> (permalink)
References <> <4f629f8d-7980-c6d8-fdb0-acb05c2b3bdc@SDF.ORG>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

At Mon, 8 Dec 2025 06:51:51 +0000 (UTC), RVP <rvp@SDF.ORG> 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 <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 | NextPrevious in thread | Next in thread | Find similar


Thread

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