sh-find-prev-matching

sh-find-prev-matching is a compiled Lisp function in `sh-script.el'.

(sh-find-prev-matching OPEN CLOSE &optional DEPTH)

Find a matching token for a set of opening and closing keywords.
This takes into account that there may be nested open..close pairings.
OPEN and CLOSE are regexps denoting the tokens to be matched.
Optional parameter DEPTH (usually 1) says how many to look for.