【发布时间】:2015-05-15 22:59:40
【问题描述】:
我无法让这个脚本工作,在第一个 elif 周围返回错误,有人可以帮我吗?
#!/bin/sh
/var/www/vhosts/website/httpdocs/ffmpeg -i $1$2 -s qvga -vcodec libx264 -acodec aac -strict experimental -ab 64k -ac 2 -ar 44100 -f mp4 -b 384k -r 25 -movflags faststart $1com_$2
if [ "$6" = "Portrait" ]
then
/var/www/vhosts/website/httpdocs/ffmpeg -i $1$3 -vf 'transpose=1' -y -strict -2 $1$4
elif [ "$6" = "LandscapeRight" ]
then
/var/www/vhosts/website/httpdocs/ffmpeg -i $1$3 -vf 'vflip [a]; [a] hflip' -strict -2 -y $1$4
elif [ "$6" = "PortraitUpsideDown" ] && [ "$7" = "Iphone" ]
then
/var/www/vhosts/website/httpdocs/ffmpeg -i $1$3 -vf -filter_complex 'transpose=2; vflip [a]' -y -strict -2 $1$4
elif [ "$6" = "PortraitUpsideDown" ] && [ "$7" = "Android" ]
then
/var/www/vhosts/website/httpdocs/ffmpeg -i $1$3 -vf 'transpose=3' -y -strict -2 $1$4
fi
/var/www/vhosts/website/httpdocs/ffmpeg -itsoffset -1 -i $1$4 -vcodec mjpeg -vframes 1 -an -f rawvideo -strict -2 $1$5
echo $5
我这样调用文件:
sh test.sh /var/www/vhosts/website/httpdocs/public/upload/album_detail_files/6501/ 201503131239571426307580.mp4 com_201503131239571426307580.mp4 LandscapeLeft_com_201503131239571426307580.mp4 1_20150313123957snap.jpg LandscapeLeft Iphone
错误是:
test.sh: line 7: syntax error near unexpected token `elif'
'est.sh: line 7: `elif [ "$6" = "LandscapeRight" ]
比很多;)
【问题讨论】:
标签: bash shell scripting centos centos6