From owner-freebsd-questions@FreeBSD.ORG Mon Jan 12 15:34:27 2004 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 2EEF416A4CE for ; Mon, 12 Jan 2004 15:34:27 -0800 (PST) Received: from pi.codefab.com (pi.codefab.com [66.234.138.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1100C43D46 for ; Mon, 12 Jan 2004 15:34:26 -0800 (PST) (envelope-from cswiger@mac.com) Received: from [10.1.1.193] (nfw2.codefab.com [66.234.138.66]) by pi.codefab.com (8.12.10/8.12.10) with ESMTP id i0CNWP00035345; Mon, 12 Jan 2004 18:32:25 -0500 (EST) In-Reply-To: <001601c3d960$696a5550$0901a8c0@bloodlust> References: <001601c3d960$696a5550$0901a8c0@bloodlust> Mime-Version: 1.0 (Apple Message framework v609) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <94134190-4557-11D8-A7A0-003065ABFD92@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Mon, 12 Jan 2004 18:32:25 -0500 To: Xpression X-Mailer: Apple Mail (2.609) X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.61 X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on pi.codefab.com cc: FreeBSD-questions Subject: Re: Script question... 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, 12 Jan 2004 23:34:27 -0000 On Jan 12, 2004, at 6:04 PM, Xpression wrote: [ ...a question on how to change a shell script... ] Try: #! /bin/sh path=/some/dir if !([ -f $path/this.one ]); then touch $path/this.one for file in $path/file1 $path/file2 $path/file3; do echo "-----------------------------------------" >> $path/this.one echo " $file" >> $path/this.one echo "-----------------------------------------" >> $path/this.one cat $file >> $path/this.one done fi Also note that using a local variable named $path is not a good idea, since $PATH is highly important. :-) $path and $PATH are seperate in /bin/sh, but many other shells automangle the colon-seperated $PATH into the word-list format used by $path, and vice-versa. -- -Chuck