I'm pretty sure that the "$@" doesn't work for quoted strings on the command line. I ran into issues and had to come up with that insanity to get past them. Do you think it does?
The insanity came as you were using "eval" -- that causes the shell to expand and interpret the arguments provided. My modified snippet uses "exec": more efficient (since it causes the running shell to replace itself), and it doesn't do any interpretation of the arguments.
Ah, thanks for the insight!
This unfortunately doesn't work in Linux though it works great on my Mac. Linux interprets everything after the interpreter in the shebang as one big argument. So, env ends up getting "java -jar" as the exe.
While not as portable, this slight modification works. Does require java to be in /usr/bin though. :-P
(echo `#!/usr/bin/java -jar'; car blahblah.jar) > blah
Thanks for your help regarding Linux..
Beware of typo.. the command should look like
(echo '#!/usr/bin/java -jar'; cat blahblah.jar) > blah