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

  • SEARCH
  • Home
  • 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 6760209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:02:22+00:00 2026-05-26T14:02:22+00:00

From this web page : http://tldp.org/LDP/abs/html/abs-guide.html It’s mentioned the usage of the if bracket

  • 0

From this web page :

http://tldp.org/LDP/abs/html/abs-guide.html

It’s mentioned the usage of the if bracket then convention which need a space after the semicolon :

;

Command separator [semicolon]. Permits putting two or more commands on the same line.

echo hello; echo there


if [ -x "$filename" ]; then    #  Note the space after the semicolon.
#+                   ^^
  echo "File $filename exists."; cp $filename $filename.bak
else   #                       ^^
  echo "File $filename not found."; touch $filename
fi; echo "File test complete."

Note that the ";" sometimes needs to be escaped.

Does anyone know where is this coming from and if this is needed at all by certain shells?

  • 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-26T14:02:22+00:00Added an answer on May 26, 2026 at 2:02 pm

    This has become the style in the last few years:

    if [ -x "$filename" ]; then
       echo "hi"
    fi
    

    However, back when dinosaurs like Burroughs and Sperry Rand ruled the earth, I learned to write if statements like this:

    if [ -x "$filename" ]
    then
        echo "hi"
    fi
    

    Then, you don’t even need a semicolon.

    The new style with then on the same line as the if started in order to emulate the way C and other programming languages did their if statements:

    if (! strcmp("foo", "bar")) {
       printf "Strings equal\n";
    }
    

    These programming languages put the opening curly brace on the same line as the if.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently came across this web page http://www.yoda.arachsys.com/csharp/readbinary.html explaining what precautions to take when
On an iPad using Safari, go to this page: http://ifelse.org/projects/errors/viewport/test.html This is the Source:
I have used this code for extracting urls from web page.But in the line
Code first: '''this is main structure of my program''' from twisted.web import http from
I'm working on making this web page: http://jsfiddle.net/pW8yj/ and I want to get a
I am trying to understand some example code on this web page: ( http://www.csharp-station.com/HowTo/HttpWebFetch.aspx
Installed Visual Studio Web Developer 2010 Express from the ISO available from this page:
in this page of tutorial : http://java.sun.com/javaee/6/docs/tutorial/doc/bnadu.html discuss about hello2 application on samples folder.
I can't seem to figure this one out. My web page at http://rayku.com/start has
For instance my current url is http://www.sample.com/check/?code=1 Web page under this url contains a

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.