Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Oct 2001 12:03:38 -0500 (CDT)
From:      Paul Halliday <dp@penix.org>
To:        Rod Person <roddierod@hotpop.com>
Cc:        Hackers FreeBSD <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: bash scripting help/suggestions.
Message-ID:  <Pine.LNX.4.33.0110201157140.20561-100000@saruman.xwin.net>
In-Reply-To: <20011020173545.6cf189ff.roddierod@hotpop.com>

next in thread | previous in thread | raw e-mail | index | archive | help

on Sat, 20 Oct 2001, Rod Person wrote:

> I'm creating a bash script and I need to know if a directory exists
> and if it doesn't create it. So far the only why I can see to
> determine if a directory exists is to try to cd to it and if it
> doesn't exists trap the error. Is there a better way or a function
> that I am missing? If not how do you trap a error in bash, if at all

if [ -d $dir ]; then <whatever>;
	else mkdir $dir;
fi


> possible.
>
> Rod
>
> http://storm.prohosting.com/osbeef/osbeef.htm
>
> '....musical rhythms can mess with your head...'
>  - T La Rock
>      "It's your's"
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
>

Paul H.
"Don't underestimate the power of stupid people in large groups"
___________________
http://dp.penix.org



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0110201157140.20561-100000>