Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2006 23:09:31 +0000
From:      dgmm <freebsd01@dgmm.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: 'cd' ing inside a shell script
Message-ID:  <200611072309.31725.freebsd01@dgmm.net>
In-Reply-To: <00ff01c7027a$36263dd0$6501a8c0@GRANT>
References:  <00ff01c7027a$36263dd0$6501a8c0@GRANT>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611072309.31725.freebsd01>