If you just need a quick hack for personal use, you can start the Scala interpreter with a shell script that also sets an environment variable to indicate that the interpreter is running.
Also, keep in mind that there is a difference between Scala and Python, which makes the question somewhat controversial: in Scala, code expressions cannot be displayed at the top level, unless there is a Scala script, so you will never encounter the ambiguity of writing a Scala script. and then wonder if it is being performed in any other way.
source share