mkdir error in bash script

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2010-04-30T09:58:16Z Indexed on 2010/04/30 10:07 UTC
Read the original article Hit count: 296

Filed under:
|
|

Hi,

The following is a fragment of a bash script that I'm running under cygwin on Windows:

deployDir=/cygdrive/c/Temp/deploy

timestamp=`date +%Y-%m-%d_%H:%M:%S`
deployDir=${deployDir}/$timestamp

if [ ! -d "$deployDir" ]; then
    echo "making dir $deployDir"
    mkdir -p $deploydir
fi

This produces output such as:

making dir /cygdrive/c/Temp/deploy/2010-04-30_11:47:58
mkdir: missing operand
Try `mkdir --help' for more information.

However, if I type /cygdrive/c/Temp/deploy/2010-04-30_11:47:58 on the command-line it succeeds, why does the same command not work in the script?

Thanks, Don

© Stack Overflow or respective owner

Related posts about bash

Related posts about shell-scripting