Closed Thread
Results 1 to 8 of 8

Thread: she-bang #!

  1. #1
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    she-bang #!

    What is she-bang and why do we call it that??

    What is she-bang?
    she-bang or sh-bang are the first 2 characters of a line,
    indicating to the OS that a command interpreter is needed.

    These 2 characters make up a magic number, typically used in shell scripts
    and some other programs that require a command interpreter. Immediately
    following the she-bang is a path to the required interpreter.

    The # character, which is normally used to denote comments, make the
    she-bang line itself invisible to the interpreter.

    Why do we call it that?
    The # character is sometimes called sharp (sh-arp) or hash (ha-sh)
    and the exclamation point is sometime called a bang for short. sh-bang or she-bang.

    Typical usage:
    #!/bin/bash or #!/bin/env bash

    Most any shell and many interpreters can be called out this way.

    Welcome to the world of Linux scripting

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: she-bang #!

    A very important line for all Linux scripts. Without it, you won't go far! +rep

  4. #3
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: she-bang #!

    thanks for the +rep

    Yes it's very important.

    When i first started using linux (many years ago),
    I heard the term she-bang a few times and it wasn't
    until a months later that I actually learned what it meant.

    Linux newbies have a whole new vocabulary to learn,
    so simple explanations sometimes help.

  5. #4
    asafe's Avatar
    asafe is offline Programmer
    Join Date
    Jul 2009
    Location
    Here
    Posts
    110
    Rep Power
    10

    Re: she-bang #!

    The magic number #! has another mean in kernel?

  6. #5
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: she-bang #!

    Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

  7. #6
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: she-bang #!

    Quote Originally Posted by asafe View Post
    The magic number #! has another mean in kernel?
    You may be referring to file and character set identification which was discussed a few weeks ago.
    If so see link: Detect Character Set

  8. #7
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: she-bang #!

    Quote Originally Posted by marwex89 View Post
    Dude, that video was AWESOME!!

  9. #8
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: she-bang #!

    We <3 William Hung
    Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts