dimanche 13 décembre 2015

Bash command (if statement) Terminal

I have the following question:

if [ (airport en1 -s|awk 'END{print NR—}’) -lt 11]; then
    open  ~/Desktop/1-10.mp3
else if -ge 10 -lt 15
    then ~/Desktop/11-14.mp3
else if -ge 14 -lt 18
    then ~/Desktop/15-17.mp3
else if -ge 17 -lt 21
    then ~/Desktop/18-20.mp3
else if -ge 20 -lt 24
    then ~/Desktop/21-23.mp3
else if -ge 23 -lt 27
    then ~/Desktop/24-26.mp3
else if -ge 26 -lt 30
    then ~/Desktop/24-27.mp3
else if -ge 29 -lt 36
    then ~/Desktop/30-36.mp3
else if -ge 35 -lt 41
    then ~/Desktop/36-40.mp3
fi

Basically I want it to scan how many wifis there are Airport en1 -s) Then I let it count without the first line |awk 'END{print NR—}’ and then I have a series of if commands which I all need to get a more sensitive result. But it is not working right now.

Can anybody help me out please? (and yes I already read a bash tutorial ...)

Aucun commentaire:

Enregistrer un commentaire