bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reference dir ../common in script


From: Bernd Eggink
Subject: Re: reference dir ../common in script
Date: Fri, 06 Mar 2009 09:21:54 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081209)

Jan Schampera schrieb:
OnTheEdge wrote:
I'm trying to check for a directory and create it if it doesn't exist as
follows:

CommonDir="../common"
if [ -d ${CommonDir} ]; then
   mkdir "${CommonDir}"
fi

It works from the command line, but my script doesn't seem to like it and I
can't figure it out.

Thanks for any help,
Duane

You have a wrong logic. This script will mkdir if it exists.

use

[ ! -d "${CommonDir}" ]

Or use

   mkdir -p $CommonDir

Bernd

--
Bernd Eggink
http://sudrala.de





reply via email to

[Prev in Thread] Current Thread [Next in Thread]