From owner-freebsd-questions@FreeBSD.ORG Wed Jun 2 08:15:28 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CC771065673 for ; Wed, 2 Jun 2010 08:15:28 +0000 (UTC) (envelope-from aiza21@comclark.com) Received: from avmxsmtp1.comclark.com (avmxsmtp1.comclark.com [202.69.191.115]) by mx1.freebsd.org (Postfix) with ESMTP id 9E3728FC14 for ; Wed, 2 Jun 2010 08:15:27 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiAcAFuwBUzKRa1aPGdsb2JhbAAHh2SWNAEBAQE1J78phRQEg0U X-IronPort-AV: E=Sophos;i="4.53,346,1272816000"; d="scan'208";a="1662651" Received: from unknown (HELO [10.0.10.3]) ([202.69.173.90]) by avmxsmtp4.comclark.com with ESMTP; 02 Jun 2010 16:15:25 +0800 Message-ID: <4C06131A.6010107@comclark.com> Date: Wed, 02 Jun 2010 16:15:22 +0800 From: Aiza User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: "questions@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: command to strip suffix in .sh script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 08:15:28 -0000 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.