Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a number of distinct Java utilities that are shipped together. Currently there are two startup scripts for each utility: a .sh one for Linux and a .bat for Windows.

I'm thinking of rewriting the startup scripts using Python, or perhaps Ruby, Perl, Lua or other scripting language. This way I avoid having different versions for each OS.

Is this a good idea? Are there projects that already use this approach? What scripting language would be best suited for the task?

What other alternatives exist to avoid having separate .sh, .bat files for this group of utilities?

share|improve this question
    
How large are these scripts, and how difficult is it for your users to pick the correct one? –  Robert Harvey Mar 21 at 16:04
    
@RobertHarvey The scripts are not inordinately big, but there is a good number of them. The problem is not for the users; I would just prefer having a single set of scripts. –  Daniel Díaz Carrete Mar 21 at 16:10
    
So you're saying you would cut your number of scripts in half. Are you sure it's worth it, given that you'd now have to make the effort to guarantee cross-platform compatibility? –  Robert Harvey Mar 21 at 16:10
    
How about JavaScript. As far as I know you can execute JS in WSH and the Linux Shell :) –  Knerd Mar 21 at 16:25
1  
@gnat If he wants it platform independed without any additional software all his ideas are not capabale ;) –  Knerd Mar 21 at 16:52
show 3 more comments

2 Answers 2

up vote 2 down vote accepted

There is no way to accomplish what you want to do unless you are willing to have the users potentially install another language just to run your software. You can't guarantee that your users are going to have a scripting language installed. You are essentially pushing the inconvenience onto your users by asking them to install something extra just so your start-up scripts are easier for you to manage.

There is a solution to this however: continue to ship your .sh and .bat files so your software is more convenient to use but instead of maintaining them separately write a script to generate them for you in {scripting language of your choice}, possibly using {templating engine of your choice}, and have your build process run that script to generate your .bat/.sh files for you. That ensures that the logic is consistent between the platforms and you only have to maintain that logic in a single place.

share|improve this answer
add comment

In such cases, I use python scripts compiled for end-users. This ensures sufficient portability and project's simplicity. In addition, scripts shares this same configuration files as the products. It's not an answer. It's just suggestion. Your question isn't precise.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.