返回错误:
cgheonea@sd-76777:~$ /bin/bash -n monitor.sh
monitor.sh: line 22: syntax error: unexpected end of file执行以下脚本时:
#!/bin/bash
MOVIES="/tmp/movies"
declare -a format=("mkv" "mp4" "avi" "mpg" "mpeg")
declare -a lang=("en" "it" "es")
inotifywait -m -r -e close_write "$MOVIES" --format "%w%f" | while read fm;
do
EXTENSION=${fm##*.}
for i in "${format[@]}"
do
if [[ "$EXTENSION" = "$i" ]]; then
for x in "${lang[@]}"
do
python /usr/local/bin/subliminal download -l $x $fm
done
fi
done
done已修复。上面的方法是可行的。
发布于 2017-05-21 15:56:15
显而易见的一件事是,array syntax是错误的。Bash数组元素不是用逗号分隔的,而是用空格分隔的。因此,language的值是字面上的"es“、"en”和"it“。
uset应该是unset。
https://stackoverflow.com/questions/44093701
复制相似问题