How to replace a command with the result of another in linux?
You can use a dollar sign followed by the command in parentheses [$(<command>)
] to have the output of that command fed directly into the command line:
cp $(find . -name viewerApplet.jnlp) ../../sign-jar/$PROFILE/
Alternatively, you can use backticks (`):
cp `find . -name viewerApplet.jnlp` ../../sign-jar/$PROFILE/
find . -name viewerApplet.jnlp -exec cp {} ../../sign-jar/$PROFILE/ \;
-exec lets you feed the results of find to another command. {} stands in for the name of the file found. Note that if find has more than one result it will copy them all into the specified directory (presumably you have only 1 file called viewerApplet.jnlp, but exec also works for things like find . -name *.java -exec cp {} backups/ \;
)