Scala as a console scripting language

The URL I've linked to shows an approach to include every jar file in a directory (in this case a lib directory) into a classpath that you build dynamically:

#!/bin/sh
L=`dirname $0`/../lib
cp=`echo $L/*.jar|sed 's/ /:/g'`
exec scala -classpath $cp $0 $@
!#

Just use those lines of code at the top of a Scala shell script. They would replace the lines shown in my Scala shell script classpath example.