command line in AppleScript I want to create an AppleScript app with this perfectly working (bash) command:

cd /Volumes/MEDIAS/WORK/CONVERSION_VIDEO/PROXY_720P/INPUT/; for f in *.mov *.mp4; do ffmpeg -i "$f" -vcodec prores -profile:v 0 -s 1280x720 /Volumes/MEDIAS/WORK/CONVERSION_VIDEO/PROXY_720P/OUTPUT/"${f%.*}_PROXY_720P.mov" &amp;&amp; rm "$f"; done


but I get errors with the variable "$f".

How can I launch it through AppleScript?
Shell scripts/commands in AppleScript are handled with the do shell script command, which executes a shell script using the sh shell. In the short form of:

do shell script "..."


Where ... is the shell script to execute.

See AppleScript Language Guide do shell script Commands Reference and Technical Note TN2065 do shell script in AppleScript, for additional details.

What you need to do, is escape the double-quotes with a backslash, e.g. \"$f\" and elsewhere as necessary.

I've tested your command, wrapped in a do shell script command, with the necessary escaping as shown in the command below and it worked without issue.

do shell script "cd /Volumes/MEDIAS/WORK/CONVERSION_VIDEO/PROXY_720P/INPUT/; for f in *.mov *.mp4; do ffmpeg -i \"$f\" -vcodec prores -profile:v 0 -s 1280x720 /Volumes/MEDIAS/WORK/CONVERSION_VIDEO/PROXY_720P/OUTPUT/\"${‌​f%.*}_PROXY_720P.mov‌​\" &amp;&amp; rm \"$f\"; done"


Note: Because the do shell script command uses the sh shell, if the ffmpeg executable is not in the PATH passed to the shell, which is /usr/bin:/bin:/usr/sbin:/sbin, you'll need to include the fully qualified pathname to the ffmpeg executable for your command to work in AppleScript.