1 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
Your Answer