Why you should care
Using the simplified, but deprecated/discouraged commands in shell scripts can lead to minor unpredictability and less feature flexibility. It is better practice to stick to the established alternatives to these two commands, for readability, consistency and expansion.
Why you should care
Using certain syntax in shell, like these simplified commands can have issues with behavioral consistency and flexibility. Avoiding modern syntax can potentially lead to unexpected application behavior and increased development time debugging.
CAST Recommendations
Encouraging developers to read up on the latest syntax/suggested style for shell – in order to reduce their use of outdated/partially deprecated commands, even if their use might simplify the appearance of the code.
References
https://stackoverflow.com/questions/669452/is-double-square-brackets-preferable-over-single-square-brackets-in-ba
https://stackoverflow.com/questions/22709371/backticks-vs-braces-in-bash
How we detect
- ` <command> `
- [ <condition> ]
About CAST and Highlight’s Code Insights
Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.