Always start your script with #!/bin/bash.
That first line is called a shebang (#!). It tells Linux which program should run the script. Without it, your script might not run correctly.
Example:
#!/bin/bash
echo "Hello, world!"
Steps to run it:
Save it as hello.sh.
Make it executable:
chmod +x hello.sh
Run it:
./hello.sh
Output:
Hello, world!
๐ Without the #!/bin/bash line, Linux will use the shell of the session you are logged into.