Created
September 1, 2010 06:00
-
-
Save clairvy/560295 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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