Jump to content

she-bang #!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
debtboy

debtboy

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 916 posts
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 :w00t:

#2
Guest_Jordan_*

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

#3
debtboy

debtboy

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 916 posts
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. :rolleyes:

#4
asafe

asafe

    Programmer

  • Members
  • PipPipPipPip
  • 107 posts
The magic number #! has another mean in kernel?

#5
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
YouTube - american idol she bangs

+rep!
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#6
debtboy

debtboy

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 916 posts

asafe said:

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: http://forum.codecal...racter-set.html

#7
debtboy

debtboy

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 916 posts

marwex89 said:


Dude, that video was AWESOME!! :thumbup:

#8
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
We <3 William Hung :D
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa