Search code examples
bashjarspark-submit

How to wildcard a file name and run in bash?


I'm running a spark-submit with a target jar like this:

spark-submit --class com.Main  target/scala-2.11/myapp-0.0.1-assembly.jar

But the jar version can change, which will cause this command to fail. So I want to be able to wildcard that part of the file name and run, something like this:

spark-submit --class com.Main  target/scala-2.11/myapp-[anyversion]-assembly.jar

Is there some bash syntax that allows me to do that?


Solution

  • Use a wildcard:

    spark-submit --class com.Main  target/scala-2.11/myapp-*-assembly.jar
    

    However, this will only work if there's just one file matching the pattern.