← Shell Scripting (Bash) learning path
Shell Scripting (Bash) · Module 6 of 10

Your first scripts and variables

Write Bash scripts with variables and input.

📖 Key ideas

  1. Start scripts with a shebang: #!/usr/bin/env bash.
  2. Variables: name="Asha" (no spaces around =); use "$name".
  3. Read input: read -p "Name: " name.
  4. Arguments: $1, $2, $@ (all), $# (count).
  5. 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