Question

I get the following error when i try to run the script

Bash : "done" unexpected (expecting "fi")

I tried both bash and dash ,i get the same error.

topip4="false"
topip6="false"
topurl="false"
for par in "$@" ; do
    if [ "$par" == "-topip4" ] ; then
        topip4="true"
    else if [ "$par" == "-topip6" ] ; then
        topip6="true"
    else if [ "$par" == "-topurl" ] ; then
        topurl="true"
    fi
done
Was it helpful?

Solution

Change your else if into elif.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top