From owner-freebsd-questions Fri Mar 3 0:56: 8 2000 Delivered-To: freebsd-questions@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 63E2E37B507 for ; Fri, 3 Mar 2000 00:56:05 -0800 (PST) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.9.3/8.9.3) id BAA01067; Fri, 3 Mar 2000 01:24:08 -0800 (PST) Date: Fri, 3 Mar 2000 01:24:08 -0800 From: Alfred Perlstein To: Joe Park Cc: freebsd-questions@FreeBSD.ORG Subject: Re: very basic scripting questions Message-ID: <20000303012408.G14279@fw.wintelcom.net> References: <4.2.0.58.20000302214315.00c0e100@uclink4.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <4.2.0.58.20000302214315.00c0e100@uclink4.berkeley.edu>; from joepark@uclink4.berkeley.edu on Thu, Mar 02, 2000 at 09:55:07PM -0800 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Joe Park [000302 22:19] wrote: > Hello, > > I'm a newbie and I would like to ask you guys about scripting. I need to > write a script that does chmod functions on files/directories listed at > separate file. (it doesn't have to be a argument. the script already knows > the name of the file.) For example, let say there is a file list_files.txt > > list_files.txt : > 750 /usr/src/tmp > 750 /usr/src/lib > > How do I feed each line to chmod? (maybe with cat?) How about if I need > to do some filtering, using regular expression? > > I'm sorry to bother you guys with such a simple question. Where can I find > more books about unix scripting? I just bought "mastering regular > expression" from O'Reilley. Is this a right choice? > > Thank you for your help. experiance will usually get you there eventually: cut -f2 -d" " < list_files.txt | xargs chmod -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message