Back to Developer Roadmap

Strings in Bash

src/data/roadmaps/shell-bash/content/[email protected]

4.0911 B
Original Source

Strings in Bash

In Bash, strings are sequences of characters. They can be enclosed in single quotes ('...') or double quotes ("..."). Single quotes treat everything literally, meaning no variable substitution or command execution happens within them. Double quotes, on the other hand, allow for variable expansion and command substitution. Suppose you want to include a literal single quote within a single-quoted string. In that case, you'll need to escape it (usually by closing the single-quoted string, adding an escaped single quote, and then reopening the single-quoted string).

Visit the following resources to learn more: