Use $(...) notation instead of legacy `...` backticks

Backticks for command substitution are deprecated. `$(...)` nests cleanly and handles quoting correctly.

Problem

Backtick command substitution has two fatal flaws: it does not nest (`\`cmd1 \`cmd2\`\`` requires escaping), and the rules for backslash inside backticks differ from the rest of the shell, which surprises people. `$(cmd)` was introduced in POSIX explicitly to replace it.

Bad

today=`date +%F`
files=`find . -name \`pattern\``

Good

today=$(date +%F)
files=$(find . -name "$(pattern)")

Explanation

`$()` nests without escaping, lets you quote internal arguments naturally, and is the modern POSIX form. There is no portability reason to keep backticks in 2026.

When It Matters

Backticks and $(...) do the same job, but backticks cannot be nested without escaping and treat backslashes inconsistently, so any moderately complex substitution becomes unreadable and often wrong. The classic breakage is a nested substitution where the inner backslashes have to be doubled — a rule almost nobody remembers correctly. The modern form is also easier to review: the opening $( and closing ) are visually distinct, so an unbalanced substitution is obvious, whereas two identical backticks give no indication of which one opened the expression.

Second Example

Note

Inside $(...) the quoting context restarts, so nested double quotes are independent — that is what makes deep composition safe.

Exceptions

The only real reason to keep backticks is compatibility with a pre-POSIX shell, which in practice means nothing you are likely to deploy to today; $(...) has been in POSIX since 1992 and works in sh, dash, ash, busybox, ksh, and zsh. If you maintain a script that must run on a genuinely ancient system, document that constraint at the top of the file.

Faq

Q

Are backticks deprecated?

A

They are not removed and still work, but every current style guide recommends $(...) because it nests cleanly and handles backslashes predictably.

Q

Is $(...) POSIX?

A

Yes. It is specified by POSIX and supported by every shell in common use, including dash and busybox ash.

Q

Can I convert automatically?

A

For simple, non-nested cases a search and replace works. Nested backticks need manual attention because the escaping rules differ; convert those from the inside out and test the result.