Shell

Shell

Made by DeepSource

Missing } SH-1056

Bug risk
Critical

Problematic code:

#!/bin/bash
bar() { echo "hello world" }

Preferred code:

#!/bin/bash
bar() { echo "hello world";}

} is only recognized as the end of a command group when it is a separate token. If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing echo "foo}" with quotes, and therefore usually cause a syntax error. It is recommended to use ; or \n in front of it.