Re: reference dir ../common in script

2009-03-06 Thread Bernd Eggink

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





Re: reference dir ../common in script

2009-03-05 Thread Jan Schampera
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}" ]

J.





reference dir ../common in script

2009-03-05 Thread OnTheEdge

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
-- 
View this message in context: 
http://www.nabble.com/reference-dir-..-common-in-script-tp22359287p22359287.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.