Skip to content

Instantly share code, notes, and snippets.

@clairvy
Created September 1, 2010 06:00
Show Gist options
  • Select an option

  • Save clairvy/560295 to your computer and use it in GitHub Desktop.

Select an option

Save clairvy/560295 to your computer and use it in GitHub Desktop.
# scala oneliner
function scall () {
local f
while getopts 'e:B:E:' opt; do
case $opt in
B) B=$OPTARG;;
E) E=$OPTARG;;
e) f=$OPTARG;;
esac
done
shift $((OPTIND - 1))
if [[ x"$f" == x"" ]]; then
f='println'
fi
scala -e "import scala.io._;$B;(if(args.length>0)args.map(arg=>Source.fromFile(arg))else Array(Source.stdin)).foreach(s=>s.getLines.foreach($f));$E" "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment