Variable Expansion in Shell

Level 119 keystrokes

Variables are expanded with $ inside double quotes.

Shell code

# $name is replaced by the variable's value, even inside double quotes
# With name=World it prints: Hello, World (single quotes would print $name as is)
1echo "Hello, $name"

Output

Hello, World
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Shell code and how often they appear.

  • "× 2
  • ,× 1
  • $× 1

More Shell examples at level 1

← Shell typing practice