HandbrakeCLI and Shell Script

HI KM people :slight_smile:

I'm currently running the following shell script, which works fine:


However, I would like to replace the input path (and later output path) with a KM var. Unfortunately, this does not work:

Putting the $KMVAR_pathToMov in "" does not change the result, either.

Any idea how to solve this?

Thanks in advance!
Dwarfy

  1. You should definitely put $KMVAR_pathToMov in " double quotes. Always double-quote variables.

  2. In your "Set Variable" line, you have escaped the space with a \ which it does not need. That is necessary for the shell -- but only if it is not double-quoted.

  3. Using double-quotes is, IMO/IME, much easier and more reliable than using \ to escape spaces.

1 Like

Thanks! I'll for sure put every path in double quotes in a shell script in the future. Unfortunately, it doesn't seem to solve my problem, as the handbrakeCLI does not load properly. It probably has to do with running it from within KM, but I'll have to investigate further…

  1. Try changing the last item from 'ignore results' to 'show result in window.

  2. Then add 'echo ' (note the trailing space) in front of /usr/local/bin/handbrakecli to see if everything appears like you would expect.

  3. If #2 seems OK, remove echo and run the handbakecli command and see what error message you get in the Keyboard Maestro window.

1 Like