Skip to main content

Literals

Literals are fixed values in scripts, such as numbers, strings, or characters.

  • String literals: 'single quotes' (literal, no expansion), "double quotes" (allows variable expansion).
  • Numeric literals: 123, 0x1A (hex), 075 (octal).
  • Special literals: true, false, $'\n' (escaped characters).

Input:

echo "Hello World"
number=42

Output:

Hello World

Explanation: "Hello World" is a string literal; 42 is a numeric literal.

References: