[Gloucs] bash Q

Keith Edmunds keith at midnighthax.com
Sun May 13 16:16:15 BST 2007


On Sun, 13 May 2007 16:06:21 +0100
Glyn Davies <glynd at walmore.com> wrote:

> In short, how can you obtain the part of the filename after the last '.'?

lastpart=${filename##*.}

For example:

$ cat=dog.and.the.mouse
$ echo $cat
dog.and.the.mouse
$ x=${cat##*.}
$ echo $x
mouse

hth,
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