Re: Need help with shell script.
"Stanislav N. aka pztrn" <[email protected]>
| Newsgroups | comp.os.linux.misc |
|---|---|
| Organization | oldproto.ru NNTP server |
| Message-ID | <[email protected]> |
10.08.2026 09:23, c186282 wrote:
> The "#!/bin/bash" is kind of optional these days
> because almost everyone has Bash as their main
> thing anyway. SOME do install and use other shells,
> but only SOME. I think I have c-shell installed
> alongside Bash.
It *isn't optional* if you aren't launching it with bash like:
bash ./script.sh
Otherwise system won't know how to launch it.
Actually with shebang (that is how it called) you can run almost anything in "interpretator mode" (e.g. without prior compiling).
Notable exception is Go (and there are some others):
---code start
///usr/bin/env go run "$0" "$@" ; exit
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
---code end
Kind-of shebang, but not shebang.
Anyway, shebangs are useful mostly for interpretators like shell variations, python, perl and so on. Example above isn't really useful because Go will compile in native machine code (read: produce runnable binary file) blazingly fast.
--
WBR, Stanislav Nikitin a.k.a. pztrn.