Solved

Cross-platform shell scripting

Posted on 2007-11-26
4
731 Views
Last Modified: 2013-12-26
I was curious as to best practice for creating a cross-platform script to start an application via a command-line call, e.g., a java application. My goal is to start a java application on  Mac OS X, Linux, and Windows. My current practice is to have a .bat file for Windows, and a bash shell script for Mac and Linux, but I'd prefer a more platform-neutral means. The script would set the classpath and accept arguments which then get passed to the java application, in this instance. The app, and the script file, are both distributed to other compute nodes. Any suggestions would be greatly appreciated.
0
Comment
Question by:upton9265
4 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 63 total points
ID: 20352403
except windoze cmd.exe any shell is available on all platforms, at least following:
  bash, perl, sh, tclsh
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 62 total points
ID: 20352901
You have a few choices.

OS X and Linux come with bash and you can easily install bash on Windows boxes via cygwin.

Alternatively, you could write the script in Perl and then use PAR to create a single binary copy of the script to run on each platform without the need for Perl to be installed.  Note that you would need to create a binary copy for each platform though.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20632874
Forced accept.

Computer101
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now