From owner-freebsd-questions@FreeBSD.ORG Mon Aug 11 14:49:25 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 4B5ED37B401 for ; Mon, 11 Aug 2003 14:49:25 -0700 (PDT) Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7CD8D43F75 for ; Mon, 11 Aug 2003 14:49:24 -0700 (PDT) (envelope-from cnst@rbcmail.ru) Received: from user236.net406.nc.sprint-hsd.net ([65.40.91.236] helo=rbcmail.ru) by hawk.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19mKXc-0006jr-00; Mon, 11 Aug 2003 14:49:24 -0700 Message-ID: <3F380F5D.6020904@rbcmail.ru> Date: Mon, 11 Aug 2003 17:49:17 -0400 From: Constantine User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.4) Gecko/20030624 X-Accept-Language: en-gb, ru, en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: simple sh scripting. How to put a result of a command to a variable? 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 21:49:25 -0000 Hello! 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? Cheers, Constantine.