From owner-freebsd-questions@FreeBSD.ORG Mon Aug 11 15:22:13 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7EB6837B401 for ; Mon, 11 Aug 2003 15:22:13 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id D72C143F75 for ; Mon, 11 Aug 2003 15:22:12 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h7BMM7gT098757; Mon, 11 Aug 2003 17:22:07 -0500 (CDT) (envelope-from dan) Date: Mon, 11 Aug 2003 17:22:07 -0500 From: Dan Nelson To: Matthew Graybosch Message-ID: <20030811222207.GB37571@dan.emsphone.com> References: <3F380F5D.6020904@rbcmail.ru> <1060639888.14212.35.camel@christabel.starbreaker.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1060639888.14212.35.camel@christabel.starbreaker.net> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: FreeBSD Questions Subject: Re: A little Bash script to help you. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2003 22:22:13 -0000 In the last episode (Aug 11), Matthew Graybosch said: > On Mon, 2003-08-11 at 17:49, Constantine wrote: > > I am writing a script, which involves unzipping some files. I would > > have to unzip 4 different zip-files from some directory, and I > > would need to unzip them to the directory, which would have the > > same name in it as the original zip-file, i.e. I would like to run > > something like "ls *.zip", have each file name recorded in some > > variable, and do a loop like "unzip > > $filename[$i] -d $filename[$i].unzipped/". Can someone help me with the > > code? How can I put the results of a command to a variable? > > The following assumes you have the bash port installed. Just change > the ARCHIVE_DIR variable to the full path of the directory in which > you have your zip files. Make sure to save this code to a file in > "~/bin". I suggest pasting the following code into "~/bin/munzip.sh". Note that this script runs just fine with /bin/sh, so you don't need bash. -- Dan Nelson dnelson@allantgroup.com