4 ms·
Sure, but not as terrifying as people rewriting shell one-liners in python or (gasp) java.
by enriquto 9y ago
Sure, but not as terrifying as people rewriting shell one-liners in python or (gasp) java.
- pjmlp 9y agoI have been there, porting ksh scripts to Java. As much as I might like Java, this surely did not make any sense, but when people want to pay you for doing it, oh well.
- hrktb 9y agoThen a lot of people don’t understand the limits of what they’re doing. For instance piping though commands works fine until one character sequence is interpreted as EOF. The fun part is it will work most of the time, and when it fails nobody will understand why (“we didn’t touch anything”), and rewriting the thing will be a political nightmare (“it was working before and was only 3 lines, why you need so much time to redo it ?”) I think most people (me included) don’t do enough shell programming to really know the trade-off of the one-liner vs doing it in groovy, so the latter becomes the safer option (rightly so IMO)
- icebraining 9y agoone character sequence is interpreted as EOF I know this is just an example, but how would that happen?
- hrktb 9y agoYou can hit EOF or EOT in a stream of UTF-8 or other multi-byte encoding as part of a character. There must be ways to have it handled through something that understands character encodings and workaround the issue, but I know that dumb shell piping will fumble on those.
- JdeBP 9y ago% printf '\x04\necho EOT is not EOF in a pipe.\n' | bash bash: line 1: $'\004': command not found EOT is not EOF in a pipe. % Pipes do not contain line disciplines and thus do not do special character processing.
- vorg 9y agoIf you can do it as a one-liner in Bash, then you're not using the JVM. The benefit of using Apache Groovy for scripting is access to the JVM (and of course defining Gradle builds). If you don't need the JVM, then do it in Python or Ruby.
- jrs95 9y agoWell, rewriting one liners is kind of stupid, but it's probably not going to result in a nearly incomprehensible mess running in production.
- tigershark 9y agoI hope there was a reason for rewriting them.. Anyway Java is for sure NOT a scripting language. F# is much much better from that point of view, with the right tools, but sadly it is not famous enough.