6 ms·
I find that much more elegant; four lines of bash script which would run on nearly any Unix-like system, versus 49 (or a bit less if you drop the whitespace) of
by archangel_one 15y ago
I find that much more elegant; four lines of bash script which would run on nearly any Unix-like system, versus 49 (or a bit less if you drop the whitespace) of Scala, which won't. Even the shebang is three lines instead of one!
I guess this example is nice as an introduction to Scala, but it doesn't seem like Scala is a particularly appropriate replacement for any of the things one would normally use a shell script for.
- viraptor 15y ago> which would run on nearly any Unix-like system Did you mean on nearly any Unix-like system which has the output of du in the same format as the one on your machine? I don't believe those can be treated as standard if you want any kind of portability.
- archangel_one 15y agoOkay, I'm not an expert on variations between different Unices, that may well be the case. The point I was trying to make was more that it would run without having to install a great wodge of Java/Scala dependencies which aren't on most systems by default.
- opensas 15y agoWhy wouldn't it run on any unix, linux, or windows, or wherever a JVM can run? you should run it with "scala status.scala" apart from that, I came to a similar conclusion: http://playlatam.wordpress.com/2012/01/13/first-steps-with-scala-revisited-bash-and-python-strikes-back/#conclusion http://playlatam.wordpress.com/2012/01/13/first-steps-with-s...