Are "backwards" terminators for if and case unique to shell scripting?

Posted by tomjakubowski on Programmers See other posts from Programmers or by tomjakubowski
Published on 2012-06-12T04:44:31Z Indexed on 2012/06/12 4:46 UTC
Read the original article Hit count: 154

Filed under:
|
|

In bash at least, if and case blocks are closed like this:

if some-expr
then
    echo "hello world"
fi

case $some-var in
[1-5])
    do-a-thing
    ;;
*)
    do-another-thing
esac

as opposed to the more typical close of end or endif/endcase. As far as I know, this rather funny convention is unique to shell scripting and I have never seen such an odd block terminator anywhere else. Sometimes things like this have an origin in another language (like Ruby's elsif coming from Perl), or a strange justification. Does this feature of shell scripting have a story behind it? Is it found in other languages?

© Programmers or respective owner

Related posts about syntax

Related posts about shell