我的BASH项目出了问题。它是一个简单的歌曲ID3搜索应用程序。有一个错误,当我找到我的歌曲时,$SONG
没有与$FOUND
连接。然而,它一直有效,直到我在分隔线下面打印它们。出了什么问题?
TITLE=""
FOUND=""
while [ 1 -eq 1 ]; do
OUTPUT=$(zenity --forms --title="Search" --text="Search by ID3" --separator="," --add-entry="Song title")
if [ $? -eq 0 ]; then
TITLE=`echo $OUTPUT | cut -d "," -f 1`
find . -name "*.mp3" -print0 | while read -d $'\0' SONG
do
echo "$SONG"
if [ "$TITLE" ]; then
if id3info "$SONG" | grep "=== TIT2" | grep -q "$TITLE"; then
FOUND="${FOUND}${SONG}"
echo "Found song: $SONG"
echo "All: $FOUND"
fi
fi
done
echo "================================="
echo "$FOUND"
echo "$FOUND" | zenity --text-info --height 500 --width 500 --title "Songs"
else
exit
fi
done