Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cross-platform scripting for windows, Linux, MacOS X [closed]

I'm looking for cross-platform scripting (language) for windows, Linux, MacOS X. I'm tired of .bat / bash .

I would like to do things like for example ,,lock workstation'' at automatic login (I had this in X-Window but the solution was pretty ugly; now, I would like that on MS Windows and not that ugly :-) ).
Generally: automate tasks.

Or would I be better off with Windows Scripting Host?
PowerShell also comes to mind, but that's seems to Windows-only for my taste. Can languages like Python, Ruby, (Java?) interact (elegantly? sensibly?) with WSH?

Also things like DBUS, DCOM, etc come to mind as part of the picture.

Currently I use a mixture of Java, .bat, bash, Ruby, Scala; some VBA for Excel. Which sometimes gets pretty ugly.

I would like a cross-platform general solution with/using ,,native'' parts close to OS-specifics. Like e.g. Ruby driving some Windows-specific stuff (just a guess).
What do You use?
TIA

like image 375
KarolDepka Avatar asked Apr 14 '10 12:04

KarolDepka


People also ask

What is cross-platform scripting?

Batsh is a simple programming language that compiles to Bash and Windows Batch. It enables you to write your script once runs on all platforms without any additional dependency. Follow this answer to receive notifications. edited Jun 20, 2016 at 14:30. simon.

What is scripting language and its types?

Scripting languages are a specific kind of computer languages that you can use to give instructions to other software, such as a web browser, server, or standalone application. Many of today's most popular coding languages are scripting languages, such as JavaScript, PHP, Ruby, Python, and several others.

What is scripting language with example?

A scripting language is a programming language that is interpreted. It is translated into machine code when the code is run, rather than beforehand. Scripting languages are often used for short scripts over full computer programs. JavaScript, Python, and Ruby are all examples of scripting languages.

Is Shell cross-platform?

Now that you know that, you now need to know that several different dialects of shell scripts are always recognized as the scripting languages. From the above explanation, we can conclude that shell scripts are among the examples of cross-platform shells. Other examples that you can know include: Secure shell (SSH)


2 Answers

I'm a huge fan of Lua:

  • Syntax is vaguely Pascal-like and works well in scripts.

  • Superb power-to-weight ratio. Superb engineering. Very good design.

  • Extremely portable to any platform with an ANSI C compiler.

  • GUI support through wxLua and other bindings

  • Some support for hiding OS differences in common tasks, e.g., the Lua File System add-on

  • The core system and libraries are simple enough that you can understand all of what you're using, but still have excellent leverage compared to bash/bat. Expressive power is comparable to Python or Ruby.

  • You're not overwhelmed with libraries and frameworks, which can be a plus or a minus.

  • There is an excellent book: Roberto Ierusalimschy's Programming in Lua; you can get the previous edition free online.

  • Performance beats tcl, perl, python, ruby

  • For even faster performance on x86 hardware, there is LuaJIT.

  • Finally, and this is the ace in the hole: if you run into any kind of platform-specific problem, it is easy to write platform-specific C code and load it into a Lua script dynamically. Lua was designed with this task in mind and does it extremely well. You can also easily dip into C for performance (e.g., compute MD5 checksum).

Over the last 3 to 5 years, I have been gradually migrating scripts from bash/ksh/awk/sed/grep/perl into Lua. I have been very happy with the results.

like image 149
Norman Ramsey Avatar answered Sep 28 '22 05:09

Norman Ramsey


You could try Batsh

Batsh is a simple programming language that compiles to Bash and Windows Batch. It enables you to write your script once runs on all platforms without any additional dependency.

like image 36
Simon Hartcher Avatar answered Sep 28 '22 05:09

Simon Hartcher