-1

代码

if [ $setup==="y" ]
    then
        echo "kurulum:"$setup
        exit
        full_dir=$full_dir"/public"
    else
    echo "Sub-Public folder is exist? [public,web]"
        read folder_extend
        if [ $folder_extend ]
                then
                full_dir=$full_dir"/"$folder_extend
        fi
fi

运行 sh 后将参数 $setup 视图设置为“n”,但仍然条件先部分运行。哪里错码了?

谢谢。

4

1 回答 1

4

将其更改为:

if [ "$setup" = "y" ]
    then
        echo "kurulum:"$setup
        exit
        full_dir=$full_dir"/public"
    else
    echo "Sub-Public folder is exist? [public,web]"
        read folder_extend
        if [ "$folder_extend" ]
                then
                full_dir=$full_dir"/"$folder_extend
        fi
fi

它应该只是一个=,并且您需要围绕它的空间。您还应该在大多数情况下引用变量,以防它们包含空格。

于 2013-05-02T10:59:10.670 回答