Wildcard expansion (globbing) in a string composed of quoted and unquoted parts
10:22 17 Jun 2014

I have a line in a shell script that looks like this:

java -jar "$dir/"*.jar

, since I just want to execute whatever the JAR file file happens to be named in that folder. But this is not working as I expected. I get the error message:

Error: Unable to access jarfile [folder-name]/*.jar

It is taking the '*' character literally, instead of doing the replacement that I want. How do I fix this?


It is working now. I just had the wrong folder prefix :/ For anybody wondering, this is the correct way to do it.

bash shell glob quoting shopt