I was writing a simple shell script and found out that my shell script doesn't require shebang line
#!/bin/sh
If I give execute permissions to my script and execute using ./myscript.sh
. It runs fine.
I am using bash
shell and /bin/sh
is actually pointing to bash
.
lrwxrwxrwx 1 root root /bin/sh -> bash
I know that shebang line is used to tell shell which interpreter to use for your rest of the script.
If I miss shebang line in perl, give execute permissions and run ./myscript.pl
, it doesn't work.
What's actually happening here? If I use ./
, When is shebang line actually needed?