Why are bash flow control constructors incompatible?

I teach myself bash and using Learning bash shell to do this.

In flow control, I noticed that we define an if / else statement:

if [ statement_is_true ]; then
    # do stuff here
elif [ some_other_statement]; then
    # other thing
else
    # if all else fails
fi

and the case statement as such:

case $expr in
    case1 )
        ;;
    case2 )
        ;;
esac

but a for loop can be defined as

for i in $list;
do
    # something cool with the various $i
done

and while loop like

while [ condition ]; do
    # something that loops
done

Why the end of the circuit for, whileand untilis indicated done, not rof, elihwand litnu, accordingly, how if/fiand case/esacto build? (Alternatively, why is it if/fiinstead if/done?

+4
source share
1 answer

, , litnu /, esac. ., , , "end nigeb ".

fi esac . do...done , , , , .

+5

Source: https://habr.com/ru/post/1542995/


All Articles