TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

First steps with Scala, say goodbye to bash scripts…

23 pointsby opensasover 13 years ago
Playframework 2.0 is right around the corner, and it’s core is programmed in Scala, so it’s a wonderful opportunity to give this object-oriented / functional hybrid beast a try… Like many others, I will pick a very simple script to give my first steps…

6 comments

moonbootsover 13 years ago
I still prefer a simple shell script for these use cases. Here's a snippet for the translated file size calculation:<p><pre><code> translated_files=$(grep "todavida no ha sido traducida" *) total_size=$(du --summarize . | cut -f 1) translated_file_size=$(du --summarize --total $(echo translated_files) | tail -n 1 | cut -f 1) echo "translated size: ${translated_file_size}KB/${total_size}KB $(($translated_file_size/$total_size))%"</code></pre>
评论 #3455983 未加载
评论 #3455587 未加载
评论 #3459585 未加载
评论 #3459589 未加载
jcdavisover 13 years ago
A nice article, but its worth mentioning that scala for bash script usage is a non-starter for most stuff you might use bash for because JVM startup overhead, even for the client VM, is so substantial
评论 #3455635 未加载
评论 #3455584 未加载
评论 #3459596 未加载
ww520over 13 years ago
I don't get how the bash scripts are not used. It's still used at<p><pre><code> #!/bin/sh exec scala "$0" "$@"</code></pre>
评论 #3455403 未加载
评论 #3455598 未加载
opensasover 13 years ago
Thanks to everybody's feedback on this one... You encouraged me to write another article, mainly because I felt a little guilty for bashing (pun intented) bash and python ;-) Hope you like it <a href="http://playlatam.wordpress.com/2012/01/13/first-steps-with-scala-revisited-bash-and-python-strikes-back/" rel="nofollow">http://playlatam.wordpress.com/2012/01/13/first-steps-with-s...</a>
jezclaremuruganover 13 years ago
nice article, but they could have removed the last part of the title. Its a nice way to learn scala, but a poor way to say goodbye to bash.
评论 #3459155 未加载
ronreiterover 13 years ago
What's wrong with Python?
评论 #3459617 未加载