Skip to content

Instantly share code, notes, and snippets.

@oluies
Created October 8, 2011 18:29
Show Gist options
  • Save oluies/1272665 to your computer and use it in GitHub Desktop.
Save oluies/1272665 to your computer and use it in GitHub Desktop.
shell scala script
#!/bin/sh
SCRIPT="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
DIR=`dirname "${SCRIPT}"}`
exec scala $0 $DIR $SCRIPT
::!#
import java.io.File
object App {
def main(args: Array[String]): Unit = {
val Array(directory,script) = args.map(new File(_).getAbsolutePath)
println("Executing '%s' in directory '%s'".format(script, directory))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment