The Java Cafe

The Java Cafe is a community of 3,681 amazing users

Java and Cloud content, by the community for the community

Create new account Log in
loading...

Discussion on: Use the Unix "find" command to be more productive

Collapse
sharoha profile image
Rohan Sharma

What does {} specify after the exec command?

Collapse
prpatel profile image
Pratik Patel Author

The {} chars are substitution placeholders - basically means to place the found file (with full path) in that place. So if you run:
find . -name "*.java" -exec cat {}
And there's exactly two Java files under the current dir named "Main.java" and "DB.java", then this is what ultimately get executed:
cat src/main/java/Main.java
cat src/main/java/DB.java

Of course, if there are more .java files they would be found/matched then exec'd

HTH!