Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 May 2006 20:57:50 +0100
From:      Daniel Bye <freebsd-questions@slightlystrange.org>
To:        questions@freebsd.org
Subject:   Re: Bourne shell scripting resources
Message-ID:  <20060511195750.GE5531@catflap.slightlystrange.org>
In-Reply-To: <63874.209.103.215.99.1147376414.squirrel@email.polands.org>
References:  <63874.209.103.215.99.1147376414.squirrel@email.polands.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--10jrOL3x2xqLmOsH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 11, 2006 at 02:40:14PM -0500, Doug Poland wrote:
> Hello,
>=20
> Can someone point me to a good on-line reference for Bourne shell
> scripting?  I've come across some syntax I don't understand and, since
> I don't understand it, don't know how to search the web for it.
>=20
> For example, what do these special variable characters do?
>=20
> ${UNISON_SCHED%% *}      #  what does %% * do?
> ${UNISON_JOB%\.*}        #  what does %\.* do?

The man page is a good start ;-)

Here's what is has to say about your questions:

     ${parameter%word}
         Remove Smallest Suffix Pattern.  The word is expanded to produce
         a pattern.  The parameter expansion then results in parameter,
         with the smallest portion of the suffix matched by the pattern
         deleted.

     ${parameter%%word}
         Remove Largest Suffix Pattern.  The word is expanded to produce a
         pattern.  The parameter expansion then results in parameter, with
         the largest portion of the suffix matched by the pattern deleted.

In the second case, '\.*' is a shell file glob pattern.

You might also find this site interesting/useful:

http://www.shelldorado.com/

HTH

Dan

--=20
Daniel Bye

PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

--10jrOL3x2xqLmOsH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)

iD8DBQFEY5c+ixf5fBYiFmoRAsh8AKCLSRnWEzwjs8Ft8eeN7djIC8KeYQCdEpnL
jVYZ9Y/gauyV66glslr/51o=
=GUrZ
-----END PGP SIGNATURE-----

--10jrOL3x2xqLmOsH--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060511195750.GE5531>