Bash example

Chris racerx at makeworld.com
Thu Aug 20 22:55:54 UTC 2009


On Fri, 21 Aug 2009 00:52:48 +0200
Vincent Arnoux <vincent.arnoux at gmail.com> wrote:

> On Fri, Aug 21, 2009 at 00:48, Chris<racerx at makeworld.com> wrote:
> >> I would like an example bash script that checks to see if a
> >> directory exists. If it does, then remove it.
> > Actually, if many dirs exist, remove em all.
> 
> Just remove them, if they don't exist, no error will be raised:
> #! /bin/bash
> 
> rm -fr mydir1 mydir2
> 

Hmmm - that seems to work. I was toying with:

[ -a directoryname ] || echo "not there"

to see if it might be workable.

-- 
Best regards,

Chris

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

	"There's no place like 127.0.0.1"





More information about the ubuntu-users mailing list