I notice that some scripts which I have acquired from others have the shebang #!/path/to/NAME while others (using the same tool, NAME) have the shebang #!/usr/bin/env NAME.
Both seem to work properly. In tutorials (on Python, for example), there…
This may be a silly question, but I ask it still. If I have declared a shebang
#!/bin/bash
in the beginning of my_shell_script.sh, so do I always have to invoke this script using bash
[my@comp]$bash my_shell_script.sh
or can I use…
I've created a bash script but when I try to execute it, I get
#!/bin/bash no such file or directory
I need to run the command: bash script.sh for it to work.
How can I fix this?
I am wondering whether there is a general way of passing multiple options to an executable via the shebang line (#!).
I use NixOS, and the first part of the shebang in any script I write is usually /usr/bin/env. The problem I encounter then is that…
I'm confused about following script (hello.go).
//usr/bin/env go run $0 $@ ; exit
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
It can execute. (on MacOS X 10.9.5)
$ chmod +x hello.go
$ ./hello.go
hello, world
I…
In most shell scripts I've seen (besides ones I haven't written myself), I noticed that the shebang is set to #!/bin/sh. This doesn't really surprise me on older scripts, but it's there on fairly new scripts, too.
Is there any reason for preferring…
(See Use #!/bin/sh or #!/bin/bash for Ubuntu-OSX compatibility and ease of use & POSIX)
If I want my scripts to use the Bash shell, does using the .bash extension actually invoke Bash or does it depend on system config or the first shebang line. If…
So, I thought I had a good understanding of this, but just ran a test (in response to a conversation where I disagreed with someone) and found that my understanding is flawed...
In as much detail as possible what exactly happens when I execute a…
Can I assume that enough people have zsh installed to run scripts with a
#!/usr/bin/env zsh
as shebang?
Or will this make my scripts un-runnable on too many systems?
Clarification: I’m interested in programs/scripts an end user might want to run…
I want to run a bash script in a detached screen. The script calls a program a few times, each of which takes too long to wait. My first thought was to simply open a screen and then call the script, but it appears that I can't detach (by ctrl-a d)…
Simple inquiry: I have just realized that I have never seen a shebang on top of a .bashrc script, which leads me to think the system uses the default shell to source it upon login (${SHELL}). I am pondering over reasons why that is the case, i.e.…
Is it possible to have a shebang that, instead of specifying a path to an interpreter, it has the name of the interpreter, and lets the shell find it through $PATH?
If not, is there a reason why?
Suppose the default shell for my account is zsh but I opened the terminal and fired up bash and executed a script named prac002.sh, which shell interpreter would be used to execute the script, zsh or bash? Consider the following…