From owner-freebsd-questions@FreeBSD.ORG Tue Apr 11 21:56:53 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 8C75816A407 for ; Tue, 11 Apr 2006 21:56:53 +0000 (UTC) (envelope-from jan.grant@bristol.ac.uk) Received: from dirg.bris.ac.uk (dirg.bris.ac.uk [137.222.10.102]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3685F43D64 for ; Tue, 11 Apr 2006 21:56:49 +0000 (GMT) (envelope-from jan.grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk ([137.222.16.62]) by dirg.bris.ac.uk with esmtp (Exim 4.60) (envelope-from ) id 1FTQqr-0007cM-V0; Tue, 11 Apr 2006 22:56:47 +0100 Received: from cse-jg.cse.bris.ac.uk ([137.222.12.37]:60866) by mail.ilrt.bris.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.50) id 1FTQqm-0002rj-EF; Tue, 11 Apr 2006 22:56:44 +0100 Date: Tue, 11 Apr 2006 22:56:39 +0100 (BST) From: Jan Grant X-X-Sender: cmjg@tribble.ilrt.bris.ac.uk To: "gs_stoller@juno.com" In-Reply-To: <20060411.131512.22840.701172@webmail32.nyc.untd.com> Message-ID: <20060411225358.K27739@tribble.ilrt.bris.ac.uk> References: <20060411.131512.22840.701172@webmail32.nyc.untd.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spamassassin: mail.ilrt.bris.ac.uk X-Spam-Score: 0.5 X-Spam-Level: / X-Spam-Score: -1.4 X-Spam-Level: - Cc: youshi10@u.washington.edu, freebsd-questions@freebsd.org Subject: Re: Need /bin/sh script help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2006 21:56:53 -0000 On Tue, 11 Apr 2006, gs_stoller@juno.com wrote: > On Mon, 10 Apr 2006 22:30:32 -0700 Garrett Cooper wrote (my brief response follows all of his text): > > Just making a series of sh scripts to help automate updating and > whatnot of my fileserver (since I am trying to avoid having mistakes > occur with my system, and maybe help the community out a bit by > providing some decent means of updating their own machines), and I was > wondering if anyone could help me out with the following script I've > developing (the grep if statements are incorrect..): > I see a problem in the line > if [ -n `grep -e s/KERNCONF=/ /etc/make.conf` ] # want to look for > you should have double-quotes around the `grep ... conf` > because it is likely to produce more than one token and so the > [ -n ... ] statement violates the syntax (there should be exactly 1 > token between the -n and the ] , even no token there is an error, the > way that is handled is to quote it. I am writing this quickly without > bringing up my FreeBSD system to check it. Good luck. Or simply use the error status of grep, no "[" invocation: if grep -q ... then ... fi Note that if you're looking at automating the update process you should probably pay careful attention to the world/kernel update process described in the handbook; there are steps (like an initial mergemaster -p) that you will want to include. -- jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/ Tel +44 (0)117 3317661 http://ioctl.org/jan/ If you have received this email in error, do whatever the hell you want with it. It's not like I can stop you anyway.