If condition not work regular in bash

Code

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

Setup param $setup view as "n" after run sh but still condition firts part run. Where wrong code ?

Thanks.

Answers


Change it to:

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

It should just be a single =, and you need spaces around it. You should also quote variables in most contexts, in case they contain spaces.


Need Your Help

Can't get state of UISwitch when initiated in cellForRowAtIndexPath?

objective-c uitableview uiswitch

I initiate my cellForRowAtIndexPath. It shows up, but when I try to reference it from a different class, it returns (null). If I initiate it in my viewDidLoad, it works but it needs to be in the