0

这是我的脚本...我在下面收到此错误。我怀疑第二个如果其他错误但无法弄清楚..

read -p "Do you wish to continue the merge session? (y/n) " RESP
if [ "$RESP" = "y" ]; then
    co_repo=`echo $target_url | cut -d "/" -f 7`
    co_workspace="svn_promote_$co_repo"
    echo "$co_workspace ................................................."
    if [-d "$co_workspace" ] then;
        echo -e "Creating target workspace $co_workspace"
        echo -e ""
        mkdir $co_workspace
        echo -e "Checking out $target_url .."
        svn co $target_url $co_workspace
    else
        echo -e "Target workspace exists. Updating ..."
        svn update $co_workspace
    fi
else
    echo "Exiting promote session .."
fi

错误:

monday_try.sh: line 44: syntax error near unexpected token `else'
monday_try.sh: line 44: `                    else'
4

2 回答 2

3

分号在它之前 then,而不是在它之后。

于 2013-05-24T21:52:35.817 回答
1

@Wumpus 所说的,以及

if [-d "$co_workspace" ]

后面需要一个空格[

if [ -d "$co_workspace" ]
于 2013-05-25T15:02:13.573 回答