[SPARK-4504][Examples] fix run-example failure if multiple example jars present

Fix run-examples script error during multiple jars.
Modified to support failing fast similar to assembly.jar

Author: Venkata Ramana G <ramana.gollamudi@huawei.com>
I know that the old code used this style, but it would be great if we could replace all occurrences where we capture the output of `ls` with one of the recommended patterns in either of [these](http://mywiki.wooledge.org/ParsingLs) [two](http://www.dwheeler.com/essays/filenames-in-shell.html) pages (e.g. using `for f in glob_expression` or using `find`).

Even better would be to find a way to avoid having to capture this output at all