Unix Shell script vs Java

Members,
I been faced with an issue where i have to sale my project against JAVA.would like to know more on the strong point of shell script (bash shell) over java.I have a very limited knowledge on java.is there anyone who has worked on java and shell scripting in both and really been able to find out the dicrepencies from both the sides.
We will be using the oracle 10g as database but the no of interactions with database is not very frequent.
need urgent reply from you unix gurus.
thanks in advance.:slight_smile:

Is there anyone who can help me out.Please.:o

Aren't you aware you are actually trying to compare apples and oranges?

Shell script and Java are two very different kinds of languages for different purposes. I know Java pretty well and I have written shell scripts of moderate complexity in the past. But my impression so far is I never need to make a choice between the two as they are so different that a use case for Java will hardly ever fit at all for shell script, and vice versa. (Have you heard about using Java for Unix shell scripting to replace sed, grep etc.?)

true...but i have make a choice and that to quickly....main reason my project has both java as well as unix ppl involved.The work can be done both ways....but i want to know exactly what aspects of shell programming will make anything messy , that can be easily done by java,i want to know about the performance issue when you talk about database interactions,exception handlings and speed of execution of both this....do you ppl think that shell script will have a back log in this aspects?

I agree with cbkihong. I think normally, it is not an either or choice - that java would be used for things that are better in java and shell for things that are better in shell. Since you have both java and unix people involved, I suggest you ask them about the trade offs. I don't know how much we can help with out a better understanding of the details.

Java's main selling point is portability. Shell's main selling point is the ability to easily put together a wide array of pre-built tools.

Here is another way to think about it...

When the thing is production will the second level support people be Java programmers or system administrators?

What are the bits that are likely to need changing/configuring on an on going basis, and which are the fundamental building blocks that won't change?

true...guys...let me tell u a bit detail...its still in devolopment fron...when in production there will not be a constraint from the point who will be supporting it....

which will be better according to you guys in terms of database interactions....unix has sqlplus.....but does unix have exception handling that java does with ease.....?

In an ongoing basis its mostly that the files going to be increasing as the project deals mostly roams around file handlings and constant database interactions.

will unix shell script able to maintane its performance?

Again this depends what your database interactions are.

If you have standard static queries, then it is possible that scripts will be fine. If on the other hand you want to apply business logic and create dynamic queries, then it is probable that java(or another high level language) will be more flexible and maintainable, the exception being that you could also do this in perl if this qualifies as a scripting language.

no reborg...thanks for that output....but we can't use perl...does unix bash support exception handling?
and mainly static database interactions......

I think you mean "does shell scripting have exception handling".

UNIX is really the operating system. You are comparing shell scripting with Java programming, not unix programming.

To me, traditional UNIX programming means Kernighan and Ritchie C.

am bit confused with your blog....its like the OS is Unix deffinitely.....but do unix shell script be able to take up exception handling with number of file operations....we are not in a scope to use C and unix API's....purely shell script or java....whichever make the work done....am trying to back unix shell script but it being a scripting language will it be able to take up the complicasies easily.....what do u think that shell script can do and Java can't....?

Tweaked on the fly without recompiling. :slight_smile:

First off, please punctuate your posts correctly. They are difficult to read with the inappropriate use of elipsis.

Work on a system where java is not installed :smiley:

Seriously though, we cannot advise you if we don't know what your workload characteristic and business logic are. I don't mean to be rude here, but I would say that if you are not in a position to answer these questions yourself then you are not in a position to argue that shell scripting is appropriate to your needs.

So Java is a virtual machine. It has abstracted so much of the physical environment that allows it to reliably model most of the runtime errors as exceptions in a unified manner. You cannot expect an environment that lacks similar kinds of facilities to give you identical support. This is especially true of the Unix shell.

In a nutshell, generally speaking, if you have to do some Unix-specific operations, such as grepping and processing the output of "ps -aux", it's probably best to have all those processing in shell scripts. For more high-level programming with a more concrete sense of application logic, such as those involving DB access, you should likely use a more structured programming language such as C/C++/Java. Programs written in these languages are generally easier to debug when they grow large as there are ample support of tools for debugging in those environments, compared with the Unix shell.