Table of Contents

Scala - Script (Shell or Batch)

About

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

Prerequisites

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