help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] The best way to trim trailing .tiff or .tif?


From: Greg Wooledge
Subject: Re: [Help-bash] The best way to trim trailing .tiff or .tif?
Date: Fri, 5 Oct 2012 09:17:29 -0400
User-agent: Mutt/1.4.2.3i

On Thu, Oct 04, 2012 at 09:02:39PM -0500, Peng Yu wrote:
> if [[ "$f" =~ \.*.tiff ]]

In addition to the extended globbing answer already given, you should
be aware that the overzealous use of regular expressions is not always
helpful.  This is a case that can be handled more elegantly by a simple
glob:

if [[ $f = *.tiff ]]

In fact, your regular expression test wasn't even correct, as you
neglected to anchor the RE at the start and end with ^ and $ respectively,
and you backslash-escaped the wrong period.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]