command to strip suffix in .sh script

Vinny vinny-mail-01+freebsd20100602 at palaceofretention.ca
Thu Jun 3 00:45:40 UTC 2010


On 06/02/2010 04:30, Matthew Seaman wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 02/06/2010 09:24:01, Matthias Apitz wrote:
>> El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza escribió:
>>
>>> I have this code
[snip]
>> $ echo 'archivename-201006021514.34.tar.gz' | sed 's/-.*$//'
>
> archive_name=${fromarchive%-*}
>

Thanks Matthew, that's really neat.  It took me a long time
to find the correct google incantation to find the documentation
for that.  ( bourne shell pattern-matching notation )

Sure is nice to learn something new everyday.




More information about the freebsd-questions mailing list