javashell

Use java as a linux shell script language?


I used cshell/tcshell before and than turned to python.

Now I am going to integrate all my shell scripts, GUI, database, webpages together. Python is good at most of works, but it's relatively weak at GUI, general performance and third partu libraries.

So I am going to try java as my main development language. Is it good at shell interactive programming, process control, etc.?


Solution

  • Java by itself may not be the greatest shell language, because of slow boot times, lack of built-in libraries to work with the operating system, commands and files (I mean, there is even no way to copy a file in Java without resorting to creating two input and output streams and piping the data, yack!).

    However! There are plenty of JVM-based languages like, JRuby(ruby), Rhino(javascript), Jython(python), Groovy or Grash, Bean-shell, etc. that work like shell languages and can run other Java-written programs. I would recommend you have a look at Grash that is probably exactly what you need.

    Some of those language even have a way to pre-load JVM runtime to speed-up boot time (e.g Nailgun for JRuby), so that can solve the slow boot time problem. Also see this post for using Ruby(JRuby) as a shell language.