How can I use '{}' to redirect the output of a command run through find's -exec option?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Isolated
--
Chapters
00:00 How Can I Use '{}' To Redirect The Output Of A Command Run Through Find'S -Exec Option?
00:47 Accepted Answer Score 40
01:02 Answer 2 Score 5
01:19 Thank you
--
Full question
https://superuser.com/questions/231495/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #find #redirection
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Isolated
--
Chapters
00:00 How Can I Use '{}' To Redirect The Output Of A Command Run Through Find'S -Exec Option?
00:47 Accepted Answer Score 40
01:02 Answer 2 Score 5
01:19 Thank you
--
Full question
https://superuser.com/questions/231495/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #find #redirection
#avk47
ACCEPTED ANSWER
Score 40
You can do the redirection like this:
find /var/svn/* \( ! -name dir -prune \) -type d -exec sh -c 'svnadmin dump {} > {}.svn' \;
and the correct substitution will be done.
ANSWER 2
Score 5
No, however you can write a simple bash script to do that then call it from find.
Example (/tmp/dump.sh):
#!/bin/sh
svn admin dump "$1" > "$1".svn
then:
find /var/svn/* \( ! -name dir -prune \) -type d -exec sh /tmp/dump.sh '{}' \;