Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 508037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:51:57+00:00 2026-05-13T06:51:57+00:00

I’m very new to shell scripting and i’ve been struggling with the following shell

  • 0

I’m very new to shell scripting and i’ve been struggling with the following shell script. I’m posting the script and the commands i used below for your consideration please help me with the mistake i made.

#
#
#

DBG=0
RLS=0
ALL=0
CLN=0

print_help_uu()
{
        echo "Usage: $0 -D -R -A -C "; 
        echo "Where -C clean the debug project builds";
        echo "      -D to build in DEBUG config";
        echo "      -R to build in RELEASE config";
        echo "      -A to build in both configs";
        return
}

#
# Main procedure start here
#
# Check for sufficent args
#

if [ $# -eq 0 ] ; then
        print_help_uu
        exit 1
fi    

#
# Function to clean the project
#
clean()
{
        if ["$DBG"="1"]; then
            echo "Cleaning debug"

            if ["$RLS"="1"]; then
                echo "cleaning release + debug"
            else
                echo "This is bad"
            fi
        fi

        if ["$RLS"="1"]; then 
            echo "Cleaning release "
        fi
        return
}


while getopts "DRAC" opt
do
        case "$opt" in
                D) DBG=1;;
                R) RLS=1;;
                A) DBG=1;RLS=1;;
                C) CLN=1;;
                \?) print_help_uu; exit 1;; 
        esac
        clean
done   

I’m posting the commands i used to run it and the errors i got when using those commands.

----------
./BuildProject.sh -D
./BuildProject.sh: line 36: [1=1]: command not found
./BuildProject.sh: line 46: [0=1]: command not found

-----------
sh BuildProject.sh -D
BuildProject.sh: 63: [1=1]: not found
BuildProject.sh: 63: [0=1]: not found

-----------
sh ./BuildProject.sh -D
./BuildProject.sh: 63: [1=1]: not found
./BuildProject.sh: 63: [0=1]: not found

I tried to solve it in soo many ways and googled a lot before posting here. But all my trials went in vain. Please tell me where i’m doing the mistake since i’m new to shell scripting.

Thanks in Advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:51:57+00:00Added an answer on May 13, 2026 at 6:51 am

    [ is a command, but you are trying to invoke the command [1=1]. Add some whitespace:

    if [ "$DBG" = "1" ]; then
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.