Shebang line in the shell script

I used the shebang line #!/usr/bin/bash in the shell script . Shell script executed successfully even the bash binary located at /bin/ instead of /usr/bin .

Used the ./test.sh command to execute the script.

Why the shell script ran successfully ?

Hi,

The script will run successfully even if the bash binary is located at /bin/ instead of /usr/bin/ because the shell looks in multiple directories, including /bin/ and uses the shebang line to determine the interpreter regardless of its location.

so there is no need to provide path in the shebang ?