How to Run a Bash Script?

Save the script with a `.sh` extension

Add a shebang at the top, such as `#!/bin/bash`

Make the script executable with `chmod +x script.sh`

Run it with `./script.sh`

Or run it with `bash script.sh`

Or run it with `sh script.sh`

If needed, use the full path to the script

Ensure you have permission to execute the file

Suggested for You

Trending Today