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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:01:49+00:00 2026-05-28T17:01:49+00:00

I know that in the begining of .sh bash scripts is #!/bin/bash which points

  • 0

I know that in the begining of .sh bash scripts is

#!/bin/bash

which points to the command interpeter executable.

But during watching Google Python Class http://www.youtube.com/watch?v=tKTZoB2Vjuk I noticed that for python they use

#!/usr/bin/python -tt

. Surfing the Internet I also have found such styles of this notation:

#!/usr/local/bin/python

and even

#!/usr/bin/env python

.

So, I’m new with Python and I’m ordinary Linux user and I have a few questions about this “magic” line:

  1. First of all, what is the right form of this line? and why?
  2. What does -tt key means in #!/usr/bin/python -tt ?
  3. What program is parsing this line in Linux?
  4. What syntax of this line for any script?
  5. Why this line is so necessary if each file have it’s extension?
  6. And what about that in each computer interpreter for some kind of scripts will be stored in different place than in another? And script couldn’t be run.

It’s really interesting to me.
What’s this line? Why this line? How to write this line? Why in such a way?…

  • 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-28T17:01:50+00:00Added an answer on May 28, 2026 at 5:01 pm

    Question #1) The line is called a shebang, and there’s no right form that works universally. e.g.

    #!python
    #!/usr/bin/python
    #!/usr/local/bin/python
    #!/usr/bin/python -t
    

    are all valid/acceptable forms, but may not work on all systems:

    #!python will work only if the python executable is somewhere in your shell’s PATH

    #!/usr/bin/python only works if the python binary is actually in /usr/bin

    #!/usr/local/bin/python also only works if python is in /usr/local/bin

    Question #2)

    #!/usr/bin/python -tt is passing the -tt option to python, as if you’d done:

    $ python -t somescript.py
    

    at the shell prompt. You can pass arbitary command line arguments to the interpreter on the shebang line.

    Question #3)

    The line is interpreted by the OS kernel and the shell you’re currently using. The stuff after the #! simply tells the OS which program should be fired up to “execute” the rest of the script.

    Question #4)

    The script syntax depends on the language you’re using. E.g. a PHP shell script must take the form of

    #!/usr/bin/php
    <?php
      ... php code here ...
    

    A #!/usr/bin/perl perl script must use Perl syntax, etc… If you put PHP code with a Perl shebang, you’ll just have Perl barf up the script with syntax errors, as PHP code is NOT perl code

    Question #5)

    Shebangs are for Unix systems, where file extensions were never really used to identify file types to the OS. A .c file was understood to be a C language source code file, but that’s merely a convention. You could put a Bash shell script into a .c file, make it executable, and with the #!/bin/bash shebang, it would execute as a Bash script.

    Determining executable types by file extension is more of a Windows thing.

    Question #6)

    That goes back the stuff in question #1 – if the shebang claims the interpreter is at some OTHER path than where it is, this particular script can’t be executed until the shebang is fixed, or the interpreter is moved. Shebangs are very handy, but not infallible.

    Thankfully, most interpreters are installed in fairly standard locations these days, so it’d be somewhat unusual to find (say) Perl installed at /some/wonky/weird/path instead of /usr/bin

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

Sidebar

Related Questions

NOTE: I thought I was using bash, but /bin/sh is linked to /bin/dash, which
I know that |DataDirectory| will resolve to App_Data in an ASP.NET application but is
I know that IList is the interface and List is the concrete type but
I have made Bash scripts before and they all ran fine without #!/bin/bash at
I know that this question has been asked loads of times, but I have
So I know that there are differences between setTimeout and setInterval , but consider
I already know that gg=G can indent the entire file on Vim. But this
I know that I can do something like $int = (int)99; //(int) has a
I know that default cron's behavior is to send normal and error output to
I know that you can insert multiple rows at once, is there a way

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.