String is a sequence of characters. There are 3 syntax to create string.
Single Quoted, Literal String
- Character sequence between APOSTROPHE
'single quote'is literal string.
- Can contain multiple lines.
- To include a single quote inside single quoted string, use two single quotes.
- Backslash is literal, GRAVE ACCENT
$x = 'some thing' echo $x
To include a single quote inside single quoted string, use two single quotes.
# double single quote becomes a single quote $x = 'don''t' $x -eq "don't"
# backslash is literal, GRAVE ACCENT also literal $x = 'a\n`nb'