🔤Shell Script
Also known as Bash Script, Bash Scripting, sh Script, .sh File
A file of commands the shell runs in turn, so you type less.
Think of it like
It is like a to-do list you give a helper. The helper does each line in order.
Example
Jack writes a three-line script that copies his notes folder into a dated backup. A timer runs it every night.
Why it matters
Most server and build jobs are glued together with shell scripts. They turn a list of steps into one command.
Definition
Example code
bash
#!/bin/bash
echo "Backing up notes"
tar -czf "notes-$(date +%F).tar.gz" ~/notesCommon mistake
Key takeaways
- 1Commands in a file. Same as typing them.
- 2Shebang first. Names the shell to use.
- 3Run it again. One name for many steps.