One could write a shell script to compile some Java code, but that wouldn't mean that compiling code was the role of shell scripting in Java.
And considering that many Java programmers can spend a whole lifetime without using, or even understanding, shell scripting, I just have to reject the assumption in that question. Namely, that shell scripting has any role in Java. (Let alone the other assumption, that it has exactly one role in Java.)
Joined: Jun 18, 2011
I mean , have been developing Java apps for almost 3 yrs now,never used unix shell . Recently heard about a java project requirement in Java xml unix, so was wondering what role unix has here ? The only thing I can think of is probably starting/stopping server....what else we can automate java run process through bat file in Windows, does shell scritping is for unix platforms ? But that would be 2 lines of code then why specifically mentioning Unix, I think there must be more to it ...Please comment
If you're reading a job posting where the position requires knowledge of shell scripting, this means that (assuming it's not just HR piling on stuff they know nothing about) the position requires building/maintaining one or more systems with extra-java components. For example, cron jobs, script-based file import/export processes, general OS housekeeping such as logfile rotation, and so forth.
Shell scripts are the "quick-and-dirty" way of getting things done and gluing things together. They're also a lowest-common-denominator programming facility, since almost all OS's have at least one shell language. You don't have to worry about whether a "shell script VM" is installed, because there isn't one. Usually.
Shell scripts are also important in tight spaces. For example, when the system is booting up, not all system resources are yet available, since the whole idea is that the boot process preps them an brings them online, To control the prep/startup functions, shell scripts are commonly used, since they don't require source code changes/recompiles to customize, and they'll often be much smaller than an executable binary file as well.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jun 18, 2011
author and jackaroo
Unix skills are often listed in job requirements where there are back-end servers. For example, at my current job, when we deploy to the test environment, we may have to ssh to the test box to look at the log files. To look at the files we may want to use less, or grep, or tail the log in real-time, ... Someone with Unix skills can do all these easily - someone without Unix skills will have to learn the tools and commands.
Shell scripting is different - some jobs I have worked at have required it, others have not. Shell scripts can be useful during deployment procedures, or in error alerting.
shell scripts are required because they are the simplest way to program against an OS. no matter what *NIX OS you are running (ubuntu,fedora,os x,....) you can always write and run a shell script. Furthermore, the semantics of shell scripts are, of course, optimized for OS related tasks (like moving / copying / scanning files , setting permissions, and installing software ).
Try writing a java program that, for example, moves a all of the files from a directory that contain the word "apple" in them to another directory. In unix, a shell script using grep / mv can do this in two lines.
Of course, for applications, shell scripts are not the best. they are hard to read once they get complex, they are not good at conveying complex logic, they are platform dependent (*NIX only), and they can actually be quite dangerous .
Joined: Jul 23, 2010
I remember when I was working on my thesis, I had to read a lot of papers. Our college required us to have a webpage/site(JSP) for our progress. My advisor wanted me to write a review for each paper I read and post a review on my website(JSP).
I wrote a shell script which would parse through each txt file that I saved on a particular folder in my disk, and upload it using sftp to the webserver and post it in the required format.
Not that your project will be similar.. but in short shell is good for quick automation. Python works too. so do perl and others.
Many experienced programmers prefer writing millions of lines of code instead of a few lines of shell scripts.
Joined: Apr 16, 2008
Korn and Bash Shell are powerful programming languages which enable programmer's to write code that is executed directly by operating systems. When applications consist of components written in multiple programming languages such a Java, C, Oracle PL/SQL and Perl applicaiton, one or more shell scripts typically are "drivers" which glue everything together.
Aside, everything in Java is not always a web app or an EJB.
Jimmy Clark wrote:Korn and Bash Shell are powerful programming languages which enable programmer's to write code that is executed directly by operating systems.
Close, (there are many others, csh, tsh, etc.) but not exactly right.
They are scripting tools, they accept input from the user and execute programs. But they are not "directly" executed by the operating system, at least by the usual definitions of operating system. When you run a shell, say the bash shell, you are executing it the context of the bash shell as a program. Its a user mode program, just like any other program. Some commands are implemented directly by the shell itself, most are implemented by separate programs with names like 'ls', 'grep', etc.
The reason that there are so many shells in Unix/Linux is that they are not special. Anyone can write one, and lots of people have when they didn't like one of the existing ones.