0PricingLogin
Linux Command Line Mastery · Lesson

Variables, Input, and Output

Learn to declare variables, accept user input, and manage script output in shell scripts.

What are Script Variables?

In shell scripting, variables are like containers for storing data. They help make your scripts flexible and reusable.

Instead of hardcoding values, you can use variables to hold information such as filenames, user inputs, or temporary results.

Declaring & Assigning Variables

To create a variable, you simply assign a value to a name. No special keyword is needed!

  • Use NAME="Coddy" (no spaces around =).
  • Values with spaces usually need quotes (single or double).
  • Numbers don't strictly need quotes, but it's often good practice for consistency.

All lessons in this course

  1. Variables, Input, and Output
  2. Conditional Statements: `if`, `else`, `case`
  3. Loops: `for`, `while`, `until`
  4. Functions and Arguments in Shell Scripts
← Back to Linux Command Line Mastery