Saya memiliki skrip yang seharusnya menjalankan perintah di latar belakang, dan ia melakukannya. Masalahnya adalah bahwa ketika skrip datang pada perintah baca, itu tidak berhenti dan menerima input. Ini dia:
printf "Where is yo music?: "
read musicPath
cd $musicPath
ls | while read currentSong;do
seconds=`mdls "$currentSong"|sed -n '20p'|awk '{print $3}'|cut -d. -f1`
hours=$((seconds / 3600))
seconds=$((seconds % 3600))
minutes=$((seconds / 60))
seconds=$((seconds % 60))
echo "Song: $currentSong"
echo "Length: $hours:$minutes:$seconds"
afplay "$currentSong"&
printf "yes (y), no (n), or maybe (m): "
read choice
case $choice in
y)
mkdir ../Yes
mv "$currentSong" ../Yes
;;
n)
mkdir ../No
mv "$currentSong" ../No
;;
m)
mkdir ../Maybe
mv "$currentSong" ../
;;
*)
echo "Invalid option! Continuing..."
;;
esac
kill $!
done
read -p "where is yo music? " musicPath