A line that is an instruction to the kernel and a comment to the interpreter, at the same time.
A shebang starts with the same hash that marks a comment, followed by an exclamation mark, and it must be the very first two bytes of the file. The kernel reads it to find the interpreter; the interpreter then reads the same line as an ordinary comment and ignores it. A blank line before it makes it only a comment, and the file will not run as intended.
The shebang begins with the same character that marks a comment, which is exactly why it is invisible to the shell itself.
| Shebang | Hash comment marker | |
|---|---|---|
| First two bytes of the file | Required | Not relevant |
| Read by | The kernel, then ignored by the interpreter | The interpreter, which ignores it |
| Second character | An exclamation mark | Anything |
| Effect if misplaced | Silently becomes an ordinary comment | None |
| Relationship (from Symbolwise's records) | Commonly confused with Hash comment marker — The shebang begins with the same character that marks a comment, which is exactly why it is invisible to the shell itself. | Commonly confused with Shebang — A shebang line begins with this same hash, which is why the shell reads it as a comment while the kernel reads it as an instruction. |
Wikipedia · retrieved 2026-08-01
Tertiary reference. Used for widely-agreed identity, origin and current use, not for contested detail or exact dates.
POSIX.1-2024, Shell Command Language
The Open Group / IEEE · retrieved 2026-08-01
Cited for the shell's operator grammar — which characters are operators and what they do — and for nothing outside it. It standardises a notation that already existed rather than inventing one, so records here describe documented practice that POSIX also pins down.
Comment (computer programming)
Wikipedia · retrieved 2026-08-01
Tertiary reference. Used for widely-agreed identity, origin and current use, not for contested detail or exact dates.
The character is one thing; what reads it decides the meaning. Before a word on social media it makes a tag. Before a numeral it means 'number'. At the start of a line in a shell script, Python or most configuration formats it means everything after it is a comment and is ignored. A hash inside a string is none of these.
Both are drawn as one continuous decorative stroke with a closed loop and a tail that crosses back over itself, which is why a description of the shape alone reaches both. The clef is far taller, spans a stave, and its spiral encircles one specific line — that encircled line is the note G, and it is the only reason the shape is drawn where it is.
As punctuation the asterisk points at a footnote or marks a required field. In a filename pattern typed at a shell it matches any run of characters, including none — and the shell expands it against real filenames before the command runs, so the command never sees the pattern at all. That expansion is the part people are surprised by.
Check where the dot sits. A dot immediately to the right of the notehead adds half the note's value again — a dotted half note lasts three beats. A dot directly above or below the head means staccato: play it short and detached. One dot, two opposite instructions, and only position distinguishes them.