anordal / shellharden

The corrective bash syntax highlighter
Mozilla Public License 2.0
4.62k stars 129 forks source link

Use arrays, has no array use example #25

Closed EvanTheB closed 5 years ago

EvanTheB commented 5 years ago

Hello,

The section on using arrays could really do with an example of using an array in a loop.

https://github.com/anordal/shellharden/blob/master/how_to_do_things_safely_in_bash.md#use-arrays-ftw

maybe

xs=(
 a
 b
)
for x in "${xs[@]}" ; do 
 echo "$x"
end

But I did not submit a PR because I am not sure that is actually correct.

Thanks for the great resource!

anordal commented 5 years ago

Thanks for the tip!

LGTM, except that "end" should be "done". Are you using fish? So am I. ;-)

I'll look at this later today, and see how it fits in.

anordal commented 5 years ago

I expanded the array example with a loop: 55fc9ed

EvanTheB commented 5 years ago

Great stuff