denysdovhan / bash-handbook

:book: For those who wanna learn Bash
https://git.io/bash-handbook
5.69k stars 756 forks source link

Use defensive quoting in examples #37

Closed sumbach closed 8 years ago

sumbach commented 8 years ago

It's really hard to get quoting right in bash scripts. While the quotes may not be absolutely necessary in these examples, it's better to have them in place to encourage good behavior (and help anyone who copies, pastes, and modifies these examples).

denysdovhan commented 8 years ago

Right, it's a good practice, but these brings difficulty to understand, for beginners. Actually, I didn't understand why I should enclose variables in quotes too.

If we are gonna to add these quotes, we should add explanation why we enclose variables in quotes.

ghost commented 8 years ago

Agree with @denysdovhan. But on the other hand this is a living document so I don't think we should be expecting anyone to write the explanations too. If @sumbach is up for that then that's great, but in the mean time, we could merge this and add it to the roadmap to things we must explain in more detail in the future.

What do you think?

denysdovhan commented 8 years ago

@bucaran, I think we should write explanation before.

sumbach commented 8 years ago

I can try to take a crack at this later this week.

I'd like to propose moving the "Arrays" section below the "Shell expansions" section so we can talk about arrays and expansions after we've mentioned single- and double-quotes.

denysdovhan commented 8 years ago

I'd like to propose moving the "Arrays" section below the "Shell expansions" section

@sumbach Okay, it makes sense.

sumbach commented 8 years ago

@denysdovhan @bucaran I took at crack at explaining quoting, word splitting, and array expansion in more detail. Feedback welcome...

denysdovhan commented 8 years ago

LGTM. Please consider my coments.

sumbach commented 8 years ago

I've updated the branch in response to your feedback. Thanks again for working with me @denysdovhan :smile:

denysdovhan commented 8 years ago

Published as 2.0.0!

Thank you! You did a great work!

sumbach commented 8 years ago

Thanks @denysdovhan! This is an awesome resource--thank you for getting this started :beers:

denysdovhan commented 8 years ago

U R Welcome! :smiley: