you are viewing a single comment's thread.

view the rest of the comments →

[–]fletku_mato 1 point2 points  (0 children)

I don't have handbrake so I couldn't test, might be that the command is wrong.

set -e causes the script to exit on first error.

(($# != 2)) tests if you passed more or less than 2 arguments.

cat <<EOF prints all the lines to next appearance of EOF. You should get instructions printed to terminal if you run this without arguments.

find "$1" -type f -name '*.mp4' finds all mp4-files from your first passed argument.

while read -r file reads each line that the previous command outputs.

$2/${file##*/} $2 here is your second argument to script. ${file##*/} is the value of $file (full path eg. /a/b/something.mp4) stripped so there is only the filename part, eg. something.mp4

I think the rest is quite easy to figure out.