Questions tagged [shebang]

Use the tag /shebang if your question is about #!-string at the beginning of a script

A Shebang is the character sequence consisting of the characters number sign and exclamation mark (that is, "#!") at the beginning of a script.

Use the tag if your question is about shebang usage.

Further reading

129 questions
81
votes
3 answers

Is space allowed between #! and /bin/bash in shebang?

In a shebang, is a space or more allowed between #! and the interpreter? For example, #! /bin/bash. It seems work, but some said that it is incorrect.
Tim
  • 101,790
3
votes
3 answers

How to pass arguments to the shebang interpreter when executing a script?

Say I have my.script such as #!/bin/bash blah blah and the bash interpreter accepts a --verbose argument. How do I execute my.script passing --verbose to bash? I know I can do bash --verbose my.script on the command line, but I need to be able to…
beret
  • 31
1
vote
1 answer

Does a doublesharp always cancel out a shebang?

Would an extra # always cancel out the sharp exclamation? As in: Enabled: #!/foo/bar Disbabled: ##!/foo/bar Are there any known circumstances where an exec could execute the bar? Are there environments where \x23\x23\x21... is recognized magic?
user367890
  • 1,887
  • 2
  • 16
  • 27
0
votes
0 answers

Why is it spelled `#!/usr/bin/env NAME` and not` '#!NAME`

Why isn't the default behavior of the shebang line to lookup the first argument as if it was a command? It seems like it is necessary to be a path to a tool. doesn't work(why?): #!bash works: #!/usr/bin/env bash
Moberg
  • 187
0
votes
2 answers

Is this a valid shebang line?

I have the following question about UNIX: What else is needed when the top line goes #!\bin\awk -f to make it run as a command? I am thinking whatever the name of the script is it need to be given permission using chmod to make it run.