
The #! syntax is used in shell scripts to indicate an interpreter for execution under UNIX / Linux operating systems.
Let us create a small test script:

make sure it is executable:

Here is what happened when we execute the script:
[root@localhost]# ./testscript.sh
This is my first script
[root@localhost]#
you will notice that the first line of the script starts with #! and next to it is the path to bash shell program. (/bin/bash)
This term #! is called as ‘Sharp Bang‘ or Shebang.
When any scripts first line starts with Shebang,whatever follwed by it is used as an interpretor for the command listed in the script.
For e.g
#!/bin/csh
echo "this test script used csh as an interpreter.
#!/bin/ksh
echo "this test script used ksh as an interpreter.
So basically when we execute a script which contains shebang, interpreter is executed and the path used to call the script is passed as an argument to the interpreter.
If we do not provide shebang specifically, commands in the script will be executed using the current shell.