Which command substitution do you prefer in shell scripts: backquotes `` or $() syntax?

a year ago by kiri to c/linux

Looks like $(...) is better, but I still pretty often see `...` in some articles.

load all comments
excess0680 3 points a year ago

By some sheer coincidence, I searched this topic today. I’ve been a consistent user of the parenthesis expansion, but never thought of why I preferred one or the other.

I suppose the primary advantage is that $() will expand in a consistent way. You can even nest quotes and more expansions in one, while you’d struggle the same with backtick notation.

So I’ll just keep using parentheses.

path: 0 20469087, hotness: undefined, score: 3, children: 0
linux
linux

@programming.dev

login for more options
15185
5325
3562

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

go to feed...