Re: Need help with shell script.
c186282 <[email protected]>
| Newsgroups | comp.os.linux.misc |
|---|---|
| Organization | wokiesux |
| Message-ID | <[email protected]> |
On 8/10/26 07:31, Stanislav N. aka pztrn wrote:
> 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.
A special case admittedly.
However most either "./MyScript.sh" or run it
without the dot-slash from crontab or one of
the "system" calls inside popular langs.
> Actually with shebang (that is how it called) you can run almost
> anything in "interpretator mode" (e.g. without prior compiling).
Bash scripts are always interpreted ...
If you're gonna do interpreted these days, use Python.
It's a hell of a lot easier to read also ...
> 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.
Never used 'Go' and probably never will.
Most of the newer 'improved' langs aren't "improved"
at all. Most just look like 'C' with less-convenient
syntax.