Scala - Script (Shell or Batch)

Card Puncher Data Processing

About

We may also run our example as a shell script or batch command

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







Share this page:
Follow us:
Task Runner