From owner-freebsd-questions Wed Jan 22 17:18:54 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id RAA16850 for questions-outgoing; Wed, 22 Jan 1997 17:18:54 -0800 (PST) Received: from cedb.dpcsys.com (CEDB.DPCSYS.com [207.124.154.3]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA16843 for ; Wed, 22 Jan 1997 17:18:51 -0800 (PST) Received: from localhost (dan@localhost) by cedb.dpcsys.com (8.8.2/8.8.2) with SMTP id BAA11316; Thu, 23 Jan 1997 01:05:44 GMT Date: Wed, 22 Jan 1997 17:05:44 -0800 (PST) From: Dan Busarow To: Jim Bentley cc: freebsd-questions@freebsd.org Subject: Re: csh scripting In-Reply-To: <199701230036.SAA01696@main.intcomm.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Wed, 22 Jan 1997, Jim Bentley wrote: > When attempting to execute a foreach command in csh script the variables are > not set correctly. Number 1, don't script in csh. Every Unix seems to have its own set of csh bugs which are incompatable. Use sh, ksh , perl, tcl ..... :) > foreach user (cat /usr/local/www/file.lst) > > The user variable is set equal to "cat /usr/local/www/file.lst" instead of > the the data in the lines of the file. Actually $user gets set to "cat" and later to "/usr/local/www/file.lst" You need to surround the command with back ticks to have it executed. foreach user (`cat /usr/local/www/file.lst`) does what you want. But don't do it, use sh, ksh perl ..... Dan -- Dan Busarow 714 443 4172 DPC Systems / Beach.Net dan@dpcsys.com Dana Point, California 83 09 EF 59 E0 11 89 B4 8D 09 DB FD E1 DD 0C 82