FG
💻 Software

Why use parens instead of backticks for executing a command 'in situ'?

Fresh5 days ago
Mar 15, 20263961 views
Confidence Score0%
0%

Problem

I have recently started to shift my shell scripting from utilizing backticks to parens to execute a command in situ and use the results in something else. Eg: Now I use parens, substituting thusly: What is the actual difference between the two methods, and why is paren substitution considered bette…

Error Output

for line in `cat file`
do
    echo "$line"
done

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Why use parens instead of backticks for executing a command 'in situ'?

Low Risk

There is no functional difference, however makes nesting a bit nicer and easier to follow. Consider this silly example: vs Now consider doing it with a complex series of commands that do something useful ;).

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment