Download the scala binary release from Scala official website.

Setup the $SCALA_HOME and $PATH variable

$ export SCALA_HOME="/opt/scala"
$ export PATH="$PATH:$SCALA_HOME/bin"

Put the following text in HelloWorld.scala

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, world!")
  }
}

Run your first scala program!

# compile the source code. your will get ./class
$ mkdir ./classes && scalac -d classes HelloWorld.scala

# Run it
$ scala -cp classes HelloWorld
Hello, world!

# It's compiled to a java class: HelloWorld.class, java can also run this (scala-library.jar needed):
$ java -cp ./classes:$SCALA_HOME/lib/scala-library.jar HelloWorld
Hello, world!

Execute in script

Put the following content in hello.sh, then your can just run this with sh ./hello.sh

#!/bin/sh
exec scala "$0" "$@"
!#
object HelloWorld extends App {
  println("Hello, world!")
}
HelloWorld.main(args)