← Shell Scripting (Bash) learning pathShell Scripting (Bash) · Module 6 of 10
Your first scripts and variables
Write Bash scripts with variables and input.
📖 Key ideas
- Start scripts with a shebang: #!/usr/bin/env bash.
- Variables: name="Asha" (no spaces around =); use "$name".
- Read input: read -p "Name: " name.
- Arguments: $1, $2, $@ (all), $# (count).
- Run: chmod +x script.sh then ./script.sh.
💡 Real-life example: A script is a to-do list the computer follows exactly, line by line.
ShebangFirst line choosing the interpreter
$1First script argument
$#Number of arguments
readReads user input