Variables

Shell Variables

Variables store data in shell scripts. They're set without spaces around the = sign and accessed with $.
bash
# Set a variable (no spaces around =)
NAME="Linux"
AGE=30

# Use a variable
echo "Hello, $NAME"
echo "You are $AGE years old"

# Environment variables
export PATH="$PATH:/usr/local/bin"
echo $HOME
echo $USER
echo $PATH

Tip:No spaces around = when setting variables! NAME="value" is correct. NAME = "value" will fail.

Terminalbash
Welcome to the Linux Terminal Simulator!
Type commands below. Use 'help' to see available commands.
user@codewithmuh:~$
Try:

💬 Got questions? Ask me anything!