If you really want to do this, look up the java.io.File class for
things like finding out whether a particular path exists, and the
Runtime method exec() for running a command. You will need to make a
choice between a GUI or console-type I/O for the user interaction.
Java has better features for using GUIs for user interaction.
Patricia
Jack Metal wrote:
>
> I have a small script listed below, could someone give me ideas on how
> to change it to Java code to help me for learning purposes?
> Thanks for any help!
>
> #!/bin/ksh
> clear #Clear Screen
> echo "" #Echo Blank line to Screen
> echo "What drive (EX:c#t#d#):\c" #Print.
> read DRIVE #Read Variable DRIVE from input
> export DRIVE #Export Variable to Environment
> pvcreate /dev/rdsk/$DRIVE #Run a Unix Command with Variable
>
> Thanks again, for any help on this learning process for me! :-)
On 03 Jul 1999 20:26:48 PDT, Patricia Shanahan <pa...@acm.org> wrote:
>Are you sure you want to convert this to Java? Both ksh and perl seem
>to me to be more suitable for the sort of thing this script is doing.
>
>If you really want to do this, look up the java.io.File class for
>things like finding out whether a particular path exists, and the
>Runtime method exec() for running a command. You will need to make a
>choice between a GUI or console-type I/O for the user interaction.
>Java has better features for using GUIs for user interaction.
>
>Patricia
>
>
>Jack Metal wrote:
>>
> I'm trying to 'web enable' an automated project I've done in
> scripting. Plus kinda 'hide' my source code by compiling in Java.
> :-)
It is very easy to get the java source from java bytecode. Just look
up "java decompilers" on your search engine. Aside from that, if it is
running as a CGI script nobody will see your code whether it is a
shell script or a java CGI / Servlet program.
If you want to port your programs you might find something useful
among GNU's java projects:
http://www.gnu.org/software/java/java-software.html
Also for your web-applications you might want to look at the servlet
API at http://java.sun.com