About
We may also run our example as a shell script or batch command
Articles Related
Prerequisites
- the file script.sh has execute access
- the search path for the scala command is specified in the PATH environment variable.
Example
The bash shell script script.sh containing the following Scala code (and shell preamble)
#!/bin/sh
exec scala "$0" "$@"
!#
object HelloWorld extends App {
println("Hello, world!")
}
HelloWorld.main(args)
The above code can be run directly from the command shell:
./script.sh
Documentation / Reference
- man scala command