Bash sh:第7行:意外标记“done'”附近的语法错误;

Bash sh:第7行:意外标记“done'”附近的语法错误;,bash,windows-subsystem-for-linux,Bash,Windows Subsystem For Linux,当我尝试编译此脚本时: #!/bin/bash ls -f /mnt/c/Documents and Settings/user/Videos*.flv | while read -r file; do #-- get just the file name --# name="${file%.*}" echo ffmpeg -y -i $name.flv -c:v libx264 -crf 19 -strict experimental $name.mp4 done 出现以

当我尝试编译此脚本时:

#!/bin/bash
ls -f /mnt/c/Documents and Settings/user/Videos*.flv | while read -r file;
do
#-- get just the file name --#
name="${file%.*}"
echo ffmpeg -y -i $name.flv -c:v libx264 -crf 19 -strict experimental $name.mp4
done
出现以下错误:

$./video.sh
./video2.sh: line 7: syntax error near unexpected token `done'
./video2.sh: line 7: `done'

你能帮我吗?

(与问题无关,但是你的朋友。它会指出你代码中的许多问题。)代码对我有效(我的意思是它失败了,但没有任何语法错误)。可能是文件中不可见的内容,例如回车?您确定知道什么是
ls-f/mnt/c/Documents and Settings/user/Videos*.flv
输出吗?我希望有3条错误消息说“没有这样的文件或目录”。在“/mnt/c/Documents and Settings/user/”Videos*.flv中尝试
;执行…