Backticks (`) are an older way to perform command substitution in shell scripts. While they still work, they have several drawbacks compared to the
modern `$()` syntax.
The main problems with backticks are:
- Poor readability: Backticks can be hard to distinguish from regular quotes, especially in small fonts or when printed
- Nesting difficulties: You cannot easily nest backticks without complex escaping
- Editor limitations: Many text editors don’t highlight backtick syntax as well as
$()
The $()
syntax was introduced as part of POSIX standards to address these issues. It provides the same functionality but with better
visual clarity and more flexible usage patterns.
What is the potential impact?
Using backticks instead of $()
reduces code readability and maintainability. Complex command substitutions become harder to understand
and modify, especially when nesting is required. This can lead to bugs during script maintenance and makes code reviews more difficult.