Bash Script -exec syntax

I’m trying to make a Git hook bash script that minifies my JavaScript code.
So far I have come up with this, it just prints the minified JavaScript when I run the script:

#!/bin/sh
find js/ -type f -maxdepth 3 -name \*.js -exec uglifyjs {} +
exit

I’m not sure how to give the uglifyjs any commands and what the output filename should be.

  • Git Bash command not found after installing a package
  • Git Bash won't run my python files?
  • Modifying Jenkins Description for a build
  • Git Status Across Multiple Repositories on a Mac
  • bash: optimizing a git-aware shell prompt
  • My Git bash forgets my aliases. What can I do?
  • In the terminal it would be:

    uglifyjs -o js/app.js js/app.js
    

    So I’m not sure how to reference the file names etc?

  • GIT replace branch's contents
  • Git command to open all files in a commit?
  • Applying stashed commit '…' failed due to 'Applying… egit error in eclipse
  • Git on server with nginx
  • git identify the most recent intersection of two branches
  • Why/When should one ever force push?
  • One Solution collect form web for “Bash Script -exec syntax”

    Say:

    find js/ -type f -maxdepth 3 -name \*.js -exec uglifyjs -o {} {} \;
    

    instead. Note the ; instead of the + after the command.

    Git Baby is a git and github fan, let's start git clone.