On Mon, 2010-06-28, Dave Pawson wrote: > I've a fairly long bash script and I'm wondering > how easy it would be to port to Python. > > Main queries are: > Ease of calling out to bash to use something like imageMagick or Java? > Ease of grabbing return parameters? E.g. convert can return both > height and width of an image. Can this be returned to the Python program? > Can Python access the exit status of a program? > > I'd prefer the advantages of using Python, just wondering if I got > so far with the port then found it wouldn't do something?
As other remarked, bash has advantages, too. Personally, if my main job is chaining other non-trivial programs into pipelines and sequences, I don't hesitate to use Bourne shell or bash. Perl is for heavier text processing, and Python for problems with more elaborate data types. Note the distinction Bourne shell/bash. If you can get away with it, use bash for medium/large-sized scripts. Many people try to avoid bash-specific syntax, but they miss out on lots of things that make programs maintainable, like local variables. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . -- http://mail.python.org/mailman/listinfo/python-list