As long as they're single commands. Running multiple commands using `&&`, etc. is unfortunately not portable.
Edit: Never mind, I'm apparently wrong.
> rm test.txt && java -version
rm: cannot unlink entry "test.txt": The system cannot find the file specified.