Carlos Sousa <[EMAIL PROTECTED]> 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".
>> 
>>   "${1%.*}.wav"
>
> That's much better, no dependency on yet another utility, so more portable
> code.

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         [EMAIL PROTECTED]      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
        -- Abra Mitchell


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to