-
Notifications
You must be signed in to change notification settings - Fork 638
Open
Description
In the Variable substitution within quotes section there's this snippet:
# doubled single quotes act as if there are no quotes at all
echo ''$foo''
# bar
Which is a bit misleading. Bash does not define '' (two single quotes next to each other) as anything special. It's just an empty quote. So what bash does is to concatenate '' (empty) with $foo (variable) with another '' (empty). I think this example should be removed altogether and maybe there can be a section where concatenation is explained in more detail. Any whitespace (more than one, a single whitespace is respected) that is not quoted is ignored. So for example:
echo foo bar baz
# foo bar baz
echo foo ' ' bar ' ' baz
# foo bar baz
What is important to note that you don't have a specific operator or separator to concatenate in bash. That's why you can omit empty spaces and it's still valid:
echo foo' 'bar
# foo bar
echo foo''bar
# foobar
Metadata
Metadata
Assignees
Labels
No labels