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 907787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:36:29+00:00 2026-05-15T16:36:29+00:00

What is the purpose of a command that does nothing, being little more than

  • 0

What is the purpose of a command that does nothing, being little more than a comment leader, but is actually a shell builtin in and of itself?

It’s slower than inserting a comment into your scripts by about 40% per call, which probably varies greatly depending on the size of the comment. The only possible reasons I can see for it are these:

# poor man's delay function
for ((x=0;x<100000;++x)) ; do : ; done

# inserting comments into string of commands
command ; command ; : we need a comment in here for some reason ; command

# an alias for `true'
while : ; do command ; done

I guess what I’m really looking for is what historical application it might have had.

  • 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-15T16:36:30+00:00Added an answer on May 15, 2026 at 4:36 pm

    Historically, Bourne shells didn’t have true and false as built-in commands. true was instead simply aliased to :, and false to something like let 0.

    : is slightly better than true for portability to ancient Bourne-derived shells. As a simple example, consider having neither the ! pipeline operator nor the || list operator (as was the case for some ancient Bourne shells). This leaves the else clause of the if statement as the only means for branching based on exit status:

    if command; then :; else ...; fi
    

    Since if requires a non-empty then clause and comments don’t count as non-empty, : serves as a no-op.

    Nowadays (that is: in a modern context) you can usually use either : or true. Both are specified by POSIX, and some find true easier to read. However there is one interesting difference: : is a so-called POSIX special built-in, whereas true is a regular built-in.

    • Special built-ins are required to be built into the shell; Regular built-ins are only “typically” built in, but it isn’t strictly guaranteed. There usually shouldn’t be a regular program named : with the function of true in PATH of most systems.

    • Probably the most crucial difference is that with special built-ins, any variable set by the built-in – even in the environment during simple command evaluation – persists after the command completes, as demonstrated here using ksh93:

      $ unset x; ( x=hi :; echo "$x" )
      hi
      $ ( x=hi true; echo "$x" )
      
      $
      

      Note that Zsh ignores this requirement, as does GNU Bash except when operating in POSIX compatibility mode, but all other major “POSIX sh derived” shells observe this including dash, ksh93, and mksh.

    • Another difference is that regular built-ins must be compatible with exec – demonstrated here using Bash:

      $ ( exec : )
      -bash: exec: :: not found
      $ ( exec true )
      $
      
    • POSIX also explicitly notes that : may be faster than true, though this is of course an implementation-specific detail.

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

Sidebar

Related Questions

[purpose] This simple command sequence runs expected in the Windows' CMD shell: dir &
I have a shell script that runs on my server every day. It does
What is the purpose of the label attribute in a JSF Command button?
General purpose I am developing a .NET user control that can be used for
I am trying to download more than 1m pages (URLs ending by a sequence
I understand that repr() 's purpose is to return a string, that can be
First, context: I'm trying to create a command-line-based tool (Linux) that requires login. Accounts
I want to make a simple program. Don't really care what it does, actually.
I know that Tortoise HG (the windows explorer Mercurial plugin) uses Python internally, but
I want to find a linux command that can return a part of the

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.