From owner-freebsd-questions@FreeBSD.ORG Tue Nov 7 23:09:36 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 4814C16A407 for ; Tue, 7 Nov 2006 23:09:36 +0000 (UTC) (envelope-from freebsd01@dgmm.net) Received: from lon-mail-1.gradwell.net (lon-mail-1.gradwell.net [193.111.201.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4653543D60 for ; Tue, 7 Nov 2006 23:09:32 +0000 (GMT) (envelope-from freebsd01@dgmm.net) Received: from lon-mail-1.gradwell.net ([193.111.201.125] helo=webmaker country=GB ident=dave*pop3$dgmm#net) by lon-mail-1.gradwell.net with esmtpa (Gradwell gwh-smtpd 1.238) id 4551122b.2d77.d7 for freebsd-questions@freebsd.org; Tue, 7 Nov 2006 23:09:31 +0000 (envelope-sender ) From: dgmm To: freebsd-questions@freebsd.org Date: Tue, 7 Nov 2006 23:09:31 +0000 User-Agent: KMail/1.9.1 References: <00ff01c7027a$36263dd0$6501a8c0@GRANT> In-Reply-To: <00ff01c7027a$36263dd0$6501a8c0@GRANT> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200611072309.31725.freebsd01@dgmm.net> Subject: Re: 'cd' ing inside a shell script 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, 07 Nov 2006 23:09:36 -0000 On Tuesday 07 November 2006 14:37, Grant Peel wrote: > Hi all, > > Some of my webmail users are using lots of disk space. > > I want to make a shell script, like so: > > cd /home/webmail/public_html/cgi-bin/etc/users ; du -h -d1 | grep M | sort > -nr -k1 > > and run it daily in a cronjob, mailing the results to my assistants. > > with the 'cd' at that start of the script have any adverse affect on the > rest of the system or cronjobs? OK, will the scripot just complete and > exit, with the 'cd' having no affect? Do you need to be in the directory after the command has completed to then do something else. If not, will this do the job for you? du -h -d1 /home/webmail/public_html/cgi-bin/etc/users | grep M | sort -nr -k1 Dave -- Dave