Run chmod +x script.sh to give the file execute permission, then start it with ./script.sh. The ./ is needed because the shell looks up bare command names only on PATH, which does not normally include the current directory.
chmod +x script.sh
# Or using octal notation
chmod 755 script.sh
+x adds the execute bit and leaves the read and write bits alone. The octal form 755 sets every bit at once. The owner can read, write and execute, and everyone else can read and execute.
The first line of the script should also be a shebang, which tells the kernel which interpreter runs the file.
#!/bin/bash
# or
#!/usr/bin/env bash
Execute permission only matters when you run the file directly. bash script.sh works without it, because Bash is the program being run and it just reads the file as input.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓