Bourne shell scripting resources

Daniel Bye freebsd-questions at slightlystrange.org
Thu May 11 13:30:51 PDT 2006


On Thu, May 11, 2006 at 02:40:14PM -0500, Doug Poland wrote:
> Hello,
> 
> 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.
> 
> For example, what do these special variable characters do?
> 
> ${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

-- 
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 / \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20060511/83d3f6df/attachment.pgp


More information about the freebsd-questions mailing list