Current-Users archive

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

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:]]}}
[...]

$
```

-RVP


Home | Main Index | Thread Index | Old Index