1

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?

8
  • How large are these scripts, and how difficult is it for your users to pick the correct one? Commented Mar 21, 2014 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. Commented Mar 21, 2014 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? Commented Mar 21, 2014 at 16:10
  • How about JavaScript. As far as I know you can execute JS in WSH and the Linux Shell :)
    – Knerd
    Commented Mar 21, 2014 at 16:25
  • 1
    @gnat If he wants it platform independed without any additional software all his ideas are not capabale ;)
    – Knerd
    Commented Mar 21, 2014 at 16:52

2 Answers 2

3

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.

0

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.