command to strip suffix in .sh script

Aiza aiza21 at
Wed Jun 2 08:15:28 UTC 2010

I have this code

archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _`

` is the key under Esc key  and ' key is next to enter key.

fromarchive value is archivename-201006021514.34.tar.gz

I want to strip the suffix -201006021514.34.tar.gz from the archivename.

The archivename can be upper and lower case letters interspersed with _

Do I have syntax problem with the code? I get no error on it.

Do I have the tr command coded correctly?

Or should I be using something else instead of tr command?

Help please.

More information about the freebsd-questions mailing list