The problem of shell variable escaping is known, and in this simple example (as well as most other scripts I write) I choose to ignore it unless I know for a fact that the values I’m dealing with are expected to include word delimiters (IFR in bash-speak).

Specifically in this case, jar files very rarely include white space (I could say “never” as I haven’t see such a case in all my years, but as they say – “never say never”) and class files are not allowed to include white space in their names by the Java language specification.

I do quote the submitted pattern in the above example, because it is always important to make sure user input can’t escape into your script, regardless of what it is matched against 🙂 .