Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubled single quotes #58

Open
gancheff opened this issue Aug 1, 2024 · 0 comments
Open

Doubled single quotes #58

gancheff opened this issue Aug 1, 2024 · 0 comments

Comments

@gancheff
Copy link

gancheff commented Aug 1, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant