我不能让这个脚本工作,在第一个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" ]
Thans很多;)
答案 0 :(得分:0)
test.sh: line 7: syntax error near unexpected token `elif'
'est.sh: line 7: `elif [ "$6" = "LandscapeRight" ]
查看单引号如何覆盖第一个字符?这表示您有CRLF行结尾,而您的实际代码是:
elif [ "$6" = "LandscapeRight" ]\r
尝试通过dos2unix