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

How to use Web Browser's BACK-BUTTON ? in java web applications

java-ee servlets web-applications browser back-button

in javascript we can call history.back( ); method to go back to previous page. is there any way to implement same functionality in java web applications / servlets?

AutoFac - Registering a decorator for some of an open Generic

c# dependency-injection ioc-container autofac

I'm attempting to set up an Autofac module that seems to have a complicated requirement.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.