FG

How do I execute multiple commands when using find?

Fresh3 days ago
Mar 15, 202651100 views
Confidence Score1%
1%

Problem

I'm trying to run multiple commands on things I have found, how can I achieve this? does not seem to work; it instead runs cmd2 after cmd1 has been executed on every file.

Error Output

find . -exec cmd1; cmd2

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I execute multiple commands when using find?

Low Risk

In this demonstration, I'll use (or ) for the first . That will give some output and also have the selected exit code effect. Then will be used for the second one. Assume that there's one file in the current directory. A real command of this type would look like: In the second set, the escaped parentheses group the two clauses. The between them forces the test state to "false" and the causes the next expression (the second ) to be evaluated because of the . From : expr1 expr2 Two expressions in…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment