elijah
asked Jul 12 2019
edited Jul 12 2019
Answer
The shebang directive syntax follows in the below given way
#!interpreter
#!/bin/bash
In the above syntax
#! symbols are named as shebang.It is always declared at first line of any script.
these two symbols tells that the following program/scripts is going to be run or executed in the interpreter shell.(/bin/bash)
to know the shell types,the location is /etc/shells
In the below script
[root@linuxhelp ~]# vim hello.sh
#!/bin/bash
echo "Hello World"
[root@linuxhelp ~]# chmod +x hello.sh
[root@linuxhelp ~]# bash hello.shHello World
In the above script the hello.sh script is going to execute in the bash shell that is what the first line shebang represents,assigned executable permissions to the hello.sh file and run the script in the bash shell using bash as the command name
linuxhelp
asked Jul 12 2019
What does shebang first line mean
Hello,I have just started learning bash script.But i dont know what the first line
#!/bin/bash
exactly used for?Could you explain it in a simple way as i am not that good at programming skills