Re: shell script question
Carlos Sousa <email@example.com> writes:
> On Mon, 13 Oct 2003 08:30:23 +0100 Colin Watson wrote:
>> Here's a little expression that strips off any trailing ".<extension>"
>> from $1 and tacks on ".wav".
> That's much better, no dependency on yet another utility, so more portable
Not really; as was noted, the expression is bash-specific, and lots of
non-Linux Unices don't have bash. So while it's more verbose, every
/bin/sh on pretty much any sane system will be able to run
`echo "$1" | sed -e 's/\\.[^.]*//'`
(Provided, of course, that you can read the sed expression, which is
s/ \\. [^.]* / /
search-and-replace ".", then any number of not-dots, with nothing.)
David Maze firstname.lastname@example.org http://people.debian.org/~dmaze/
"Theoretical politics is interesting. Politicking should be illegal."
-- Abra Mitchell