I have a few Java tests that I'd like to run by doing java <test-name>. But, all of the files are either .class or .java.
How do I trim off the end in a Bash script or in the terminal so that the command reads java <test-name>?
I have a few Java tests that I'd like to run by doing java <test-name>. But, all of the files are either .class or .java.
How do I trim off the end in a Bash script or in the terminal so that the command reads java <test-name>?
If you're using bash you can do the following
$ file="path/Foo.class"
$ echo "${file%.class}"
path/Foo