[ale] regex for basename? (was stripping filename extensions)
Danny Cox
danscox at mindspring.com
Sun Dec 1 14:28:55 EST 2002
David,
On Sun, 2002-12-01 at 12:16, David S. Jackson wrote:
> I was wondering if there's a way to make basename accept a regex
> for a suffix. I just tried it, but no luck for me yet.
AFAIK, basename uses strings, not regexes. I agree that it would be
quite useful, but no joy.
Then again, the ${file%.*} construct should do what you wish, and
probably takes up less space.
As far as handling *.jpg vs. *.JPG, I'd say have a renaming party once
on the directory when it's built, and be done with it, or insure that
any script that creates .JPG files "knows" to rename 'em at the time of
creation.
On the other hand, you could right your own basename that WOULD take a
regex, and perhaps be adopted into the GNU sh-utils package. Your own
claim to fame! ;-)
--
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.
Danny
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list