You are not logged in.

#1 2010-04-20 21:34:35

lastchancetosee
Member
From: Berlin
Registered: 2009-02-19
Posts: 131

Language other than bash for calling external programs

Hi,
sorry for the unspecific title, I couldn't think of a better summary.

The problem is this: I have written a script to encode a DVD to H264 and Vorbis. Since it basically just performs some (OK, by now: A lot of.) management and then calls a external programs, Bash was the obvious choice.

However, the administrative stuff the script does (evaluating user input, calculations etc.) was already a nightmare to code in Bash (lack of arithmetic, lack of data types, proper functions, lack of c-like structs etc.), and I now want to make it even more flexible in what the user (me) can ask of it (it's also going to use a config file, which is another thing that gets ugly fast). Frankly, I can't stomach that.

So the question is this: What language would be sensible for a program the most important function of which is calling other programs?
Simply executing them from the main program isn't enough, unfortunately, because I want to make use of multicore system by for example simultaneously extracting streams and encoding them (right now that is done through named pipes), ideally I'd need a way to multithread not internal functions/routines but external programs (Through pipes or whatever).

I'd prefer an interpreted language, but it's not a requirement.


My ship don't crash! She crashes, you crashed her!

Offline

#2 2010-04-20 21:44:32

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Language other than bash for calling external programs

Since you're translating from bash Perl might be a good choice. For parallel execution it's got thin wrappers around the 'fork' and 'socket' system calls.

Offline

#3 2010-04-21 01:03:56

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: Language other than bash for calling external programs

I second Perl.  If you're doing particularly hairy logic Python may be a better choice for its clarity, but it will be slightly more verbose and require some more thought than the equivalent Perl script.

Offline

#4 2010-04-21 01:05:18

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: Language other than bash for calling external programs

I second what peets said. Perl is definitely you're best option here, in my opinion anyways. It has the best (by which I mean easiest) system interface of any scripting langauge I've worked with, and if you want a simple configuration file reader, perl's regex'es are king. Perl also takes a lot of features from the shells, such as the file test operations. If the project get's really big and hairy though, it might be worth considering python as a cleaner, stricter alternative.

Hope that helps!

Offline

#5 2010-04-21 07:01:53

likelightweight
Member
Registered: 2010-04-21
Posts: 2

Re: Language other than bash for calling external programs

I too prefer Perl as a shell scripting language, even though I am comfortable in Python. Perl is just more concise for small tasks like this.

Offline

#6 2010-04-21 16:44:13

lastchancetosee
Member
From: Berlin
Registered: 2009-02-19
Posts: 131

Re: Language other than bash for calling external programs

Unanimous consent! smile Thanks a bunch, Perl it is, then. It's always nice to learn a new language ...


My ship don't crash! She crashes, you crashed her!

Offline

Board footer

Powered by FluxBB