[Gloucs] bash Q

Keith Edmunds kae at midnighthax.com
Sun May 13 17:48:15 BST 2007


On Sun, 13 May 2007 17:22:38 +0100
Paul Broadhead <lug at twinmoons.clara.co.uk> wrote:

> I don't know what the ##*. above is doing exactly

The syntax is ${variable##pattern}, and will remove the longest part of
'variable' that matches 'pattern' and return the remainder. In this case,
the pattern is '*.' (this is shell patterns, not regular expressions), so
that matches 'anything' followed by '.'. The double hash means 'remove the
longest matching part' (as opposed to one hash, which would remove the
shortest matching part).

'man bash' and search for "Parameter Expansion" to see more similar
constructs.

Keith

-- 
Keith Edmunds

+---------------------------------------------------------------------+
|  Tiger Computing Ltd  |  Helping businesses make the most of Linux  |
|  "The Linux Company"  |       http://www.tiger-computing.co.uk      |
+---------------------------------------------------------------------+



More information about the gloucs mailing list