I have a linux scripting project I'm making for school. I'm making an MP3 player but I have only just started making the interface and already ran into problems i can't seem to fix. The problem seems to be linked to the if statement, something that i keep having problems with even though my syntax is right. The code is in no way finished. mp3Player.sh is the name of my script.
This is the error message I get when starting the script, it just keep printing these three lines to the terminal until i force stop it:
./mp3Player.sh: line 44: [: too many arguments
./mp3Player.sh: line 47: [: too many arguments
./mp3Player.sh: line 51: [: too many arguments
#!/bin/bash
if [[ $(find /home -type d -name $1) ]] then
map=find /home -type d -name $1
else dialog --infobox "De map bestaat niet of u heeft geen map als argument meegegeven" 5 50 exit fi
temp_songs=mktemptrap "rm -f $temp_songs" EXIT temp_playlists=mktemp -dtrap "rm -rf $temp_playlists" EXIT
echo $temp_songs
find $map -iname "*.mp3" > $temp_songs
while true do exec 3>&1
menu_keuze=$(dialog \ --backtitle "MP3-Speler" \ --title "Menu" \ --clear \ --cancel-label "Afsluiten" \ --menu "Kies een optie:" 10 40 3 \ "1" "Liedjes" \ "2" "Speellijsten" \ "3" "Speellijst maken" \ 2>&1 1>&3)if test $? -eq 1 -o $? -eq 255 then exit fi if [ $menu_keuze -eq 1 ] then echo "Keuze 1" elif [ $menu_keuze -eq 2 ] then echo "Keuze 2" elif [ $menu_keuze -eq 3 ] then exec 3>&1 naam=$(dialog \ --backtitle "MP3-Speler" \ --title "Playlist maken" \ --cancel-label "Teruggaan" \ --clear \ --inputbox "Geef de naam van je playlist in" 8 60 \ 2>&1 1>&3) echo $naam fi done rm -f $temp_songs rm -fr $temp_playlists
Aucun commentaire:
Enregistrer un commentaire