Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jun 2010 16:15:22 +0800
From:      Aiza <aiza21@comclark.com>
To:        "questions@freebsd.org" <questions@freebsd.org>
Subject:   command to strip suffix in .sh script
Message-ID:  <4C06131A.6010107@comclark.com>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C06131A.6010107>