From owner-freebsd-questions Wed Mar 11 16:06:34 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA14100 for freebsd-questions-outgoing; Wed, 11 Mar 1998 16:06:34 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA14092 for ; Wed, 11 Mar 1998 16:06:23 -0800 (PST) (envelope-from grog@lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.8.7/8.8.5) with ESMTP id KAA22985; Thu, 12 Mar 1998 10:36:13 +1030 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.8.8/8.8.7) id KAA04520; Thu, 12 Mar 1998 10:36:13 +1030 (CST) (envelope-from grog) Message-ID: <19980312103613.24718@freebie.lemis.com> Date: Thu, 12 Mar 1998 10:36:13 +1030 From: Greg Lehey To: greg@merrimack.edu, FreeBSD Questions Subject: Re: for loop at your command prompt References: <3506FEC1.7D9312B2@merrimack.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89i In-Reply-To: <3506FEC1.7D9312B2@merrimack.edu>; from Greg Fraize on Wed, Mar 11, 1998 at 04:14:41PM -0500 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 11 March 1998 at 16:14:41 -0500, Greg Fraize wrote: > can someone please tell me how I could do a > for loop at my shell prompt... > I've seen it done before...but I was un-able to remember what > that person type ..thans This is really a question for -questions, not -hackers. I'm redirecting accordingly. That depends on your shell. You *should*, of course, be using a Bourne-style shell. For that, the syntax is: for in do ; done For example, to compare all the files in the current directory which also exist in another directory, you might enter: otherdir=../foo # name of the other directory for i in *; do if [ -f $i -a -f $otherdir/$i ]; then cmp $i $otherdir/$i fi done Greg To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message