How do I execute multiple commands when using find?
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
Fix for: How do I execute multiple commands when using find?
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