From owner-freebsd-questions@FreeBSD.ORG Tue Jan 8 06:14:34 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A400416A46B for ; Tue, 8 Jan 2008 06:14:34 +0000 (UTC) (envelope-from prvs=johnl=0886cb338c@iecc.com) Received: from gal.iecc.com (gal.iecc.com [208.31.42.53]) by mx1.freebsd.org (Postfix) with ESMTP id 11DC013C465 for ; Tue, 8 Jan 2008 06:14:33 +0000 (UTC) (envelope-from prvs=johnl=0886cb338c@iecc.com) Received: (qmail 21833 invoked from network); 8 Jan 2008 05:47:51 -0000 Received: from simone.iecc.com (208.31.42.47) by mail1.iecc.com with QMQP; 8 Jan 2008 05:47:51 -0000 Date: 8 Jan 2008 05:47:53 -0000 Message-ID: <20080108054753.90411.qmail@simone.iecc.com> From: John Levine To: freebsd-questions@freebsd.org In-Reply-To: <20080108053408.GA95218@procacci.kicks-ass.org> Organization: X-Headerized: yes Mime-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit Cc: pprocacci@datapipe.com Subject: Re: is there a /bin/sh method to tell the ending of a file 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: Tue, 08 Jan 2008 06:14:34 -0000 >--------------------- >#!/bin/sh > >if [ ".gz" = "`echo \"$STRING\" | sed -n 's/.*\(\.gz\)$/\1/p'`" ]; then > echo test; >fi Ewwww. I think that we can now safely take advantage of features added to the shell in the late 1970s. ----------------------- #!/bin/sh case "$1" in *.gz) echo that is a gzipped file ;; *) echo that is not a gzipped file ;; esac -----------------------