Bash Script Works in Terminal –– Fails in Do Shell Script with Applescript

Joined
Oct 1, 2015
Messages
1
Reaction score
0
Hi

This bash script works 100% when launched from the Terminal but fails when I call it from applescript.
When run from applescript's do shell script "/bin/sh /Users/robert/Desktop/Watch/gifenc.sh"
The script
  • Names the gif file to * .gif
  • Cannot move the file to the correct directory

Any help is appreciated.


#!/bin/sh

fps=8
scale=400
palette="/tmp/palette.png"
filters="fps=$fps,scale=$scale:-1:flags=lanczos"

destDIR="/PATH/TO/DROPBOX/DIR"
curDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
incomingDIR=$curDIR/_incoming

ffmpeg=$curDIR/ffmpeg/ffmpeg


for f in *.mov
do

fbname=$(basename "$f" .mov)
fbAbsPath=$incomingDIR/$fbname
$ffmpeg -v warning -i $fbAbsPath.mov -vf "$filters,palettegen" -y $palette
$ffmpeg -v warning -i $fbAbsPath.mov -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $fbAbsPath.gif
#rm $fbAbsPath.mov
mv -f $fbAbsPath.gif $destDIR/$fbname.gif
done
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top