${VERSION%.*} in DETAILS - Was - Re: [Lunar-commits] <moonbase> Twisted: Version bumped to 11.0.0 + DETAILS fixes
Stefan Wold
ratler at lunar-linux.org
Wed Jun 15 12:23:14 CEST 2011
On Wed, 2011-06-15 at 11:19 +0200, Duncan Gibson wrote:
> I read the bash man page on ${parameter%word} but I'm not really any
> wiser on what the substitution could potentially expand to and match.
> Any chance of a "Bash for Dummies" explanation on what this will do?
It's quite simple really. ${parameter%word} would remove first match of
'word' from the end of the parameter (string). ${VERSION%.*} means
remove first occurence of . read from right to left and everything after
it using '*'. If VERSION is 11.2.3 that would give you '11.2'. If you
want '11' instead all you need to do is to add another % like: ${VERSION
%%.*}, this means longest match possible. First match would remove .3,
the second match .2 (read from right to left ie suffix) there third will
not match since there's no . in front of 11.
It's also possible to do the removal from the begining (prefix) by using
# or ## instead of % or %%. ${VERSION#*.} would then give you '2.3' and
${VERSION##*.} would give you '3'.
I hope that made things a bit more clear.
>
> Also, like sofar's fix in theedge that will remove the need for $C_FIFO,
> is the plan to replace:
>
> a) all use of $MAJOR,
> b) all use of $VERSION in the SOURCE_URL with ${VERSION%.*}
>
> throughout the complete moonbase?
Yes, we should. It's mostly KDE and gnome stuff that use MAJOR today I
believe, shouldn't be to hard to fix.
--
Sincerely
Stefan Wold
Lunar Linux developer - PGP public key 9FF9A9CF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://foo-projects.org/pipermail/lunar-dev/attachments/20110615/0d6b516e/attachment.bin>
More information about the Lunar-dev
mailing list