I’m wondering if there is some way to get the scripts file name programatically and print it to the console, eg in php it’s SCRIPT_NAME in batch it’s %0 in some other languages it’s arg[0]
without writing some complex routines is this possible in scala or is it so limited?
If you’re executing a scala script using
scala <scriptname>you can get the name as follows:Gives me the output:
EDIT: Forgot to mention, code is from this post: http://rosettacode.org/wiki/ScriptName#Java as pointed to in this post: How do I get the current script or class name in Scala?