As a quick note, if you need an example of how to write a Scala shell script that reads from STDIN (standard input) and writes to STDOUT (standard output), this code shows a solution:
#!/bin/sh
exec scala -savecompiled "$0" "$@"
!#
import scala.io.StdIn
var line = ""
while ({line = StdIn.readLine(); line != null}) {
println(line)
}