1

我的 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
4

0 回答 0