Running Scripts
In this page:
Running Scripts
A Bash script is run either by passing it to the bash interpreter directly, or by making it executable and running it as its own program. bash script.sh always works regardless of permissions. Running it directly as ./script.sh requires execute permission on the file first.
Note: bash script.sh works even without execute permission, since you're invoking bash explicitly.
Example: Running Scripts
# Run with the interpreter directly
bash script.sh
# Or make it executable and run it directly
chmod +x script.sh
./script.sh
⚠️ Run this command in your terminal.
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: