I have a short question, and I'm breaking my - my probably stupid - head over it.
#!/bin/bash if [ "$1" = "-p" ] then echo -e "Doing a Pacman-Update with \e[0;31mStandard\e[00m settings." pacman -Suyy elif [ "$1" = "-y" ] if [ "$2" = "-s" ] then echo -e "Doing a Yaourt-Update \e[0;31mwithout asking\e[00m!" yaourt -Suyy --aur --noconfirm else echo -e "Doing a Yaourt-Update \e[0;31mwith asking\e[00m!" yaourt -Suyy --aur fi #else # echo -e "Please specify the correct options! packages [-p] [-y] [-s]" fi
/scripts/packages: Zeile 18: Syntaxfehler beim unerwarteten Wort (Syntaxerror at unexpected word) `fi'
/scripts/packages: Zeile 18: `fi
Why is fi and unexpected word? It closes my first if. Does not work with the else either, then it says that else is unexpected.
I hope bash does not expect a bush of flowers and a goldring from me.
Last edited by ThunderRush (2013-01-31 13:26:18)
bash expects a then after elif.
Try to put a second "then" after your line with the elif. Should work fine then.
Last edited by gridcol (2013-01-31 13:30:00)
Thank you two guys a lot. I asked someone who was supposed to know such stuff, but he said that I don't need a than after elif.