anordal / shellharden

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

It doesn't work #27

Closed gsklee closed 5 years ago

gsklee commented 5 years ago

I tried it out on a simple code snippet:

https://i.imgur.com/X2L5aHS.png

If I am not mistaken about how to use Shellharden or it's whole premise, there should be a warning at L4's $line for not being "$line"; however I am not seeing anything.

anordal commented 5 years ago

Try harder. Your script is well-formed.

From how_to_do_things_safely_in_bash.md:

Shellharden does honor a few exceptions:

* variables of invariably numeric content: $?, $# and array length ${#array[@]}
* assignments: a=$b
* the magical case command: case $var in … esac
* the magical context between double-brackets ([[ and ]]) – this is a language of its own.

You have the latter case: $line is in double-brackets, and allowing that is a feature: #8

gsklee commented 5 years ago

Good to know, thanks!