Skip to content

Instantly share code, notes, and snippets.

@rockymadden
Last active May 31, 2018 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockymadden/3467353 to your computer and use it in GitHub Desktop.
Save rockymadden/3467353 to your computer and use it in GitHub Desktop.
Scala bash script header. Nice because it will automatically load jars in the same directory into the classpath. I use it when making thin CLI wrappers around sibling projects APIs. Works on all OS X and Debian machines I have tried.
#!/bin/bash
dir="`dirname \"$0\"`"
dir="`( cd \"$dir\" && pwd )`"
cp=`echo $dir/*.jar|sed 's/ /:/g'`
exec scala -classpath "$cp" -savecompiled "$0" "$@"
!#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment