A tool for Python - request for some advice

Mike Meyer mwm at idiom.com
Wed Jun 22 08:18:48 EDT 2005


"TPJ" <tprimke at interia.pl> writes:

> I've written this script in bash, because I thought it would be better
> to have a script which would run in environment without Python (it all
> was about installing Python anyway!). I used bash, dialog, wget... And
> now someone suggested, that I shuld use Python. That using Python would
> lead to clearer and - probably - smaller code. (I have to admit it - my
> code in bash is just messy.)
> 
> And now I'm considering this idea. Python is already present on
> (almost?) every distribution today, so why worry about it's presence?

Is your target platform Linux? I've seen the claim that every Linux
distro comes with Python installed, but can't verify it.

On the other hand, not every Unix distribution comes with Python
installed.  BSD systems for instance tend to be pretty
minimalist. Solaris isn't minimalist, but you have to get Python from
a third party. This is probably true of other commercial Unix
distributions as well. MacOS X is a known exception - it comes with
Python preinstalled.

Then again, the same comments apply to bash. Distributions that have
their roots in AT&T Unix probably don't come with bash by default,
with Mac OS X being an exception. This makes depending on bash a bad
idea if you want to write a script that portable across Unix distros.

If your target platform is Linux, indications are that python is as
portable as bash. If your target platform is Unix, then the same is
true - except you shouldn't be writing bash if you want
portability. Try reading <URL:
http://www.bsdatwork.com/2004/03/04/what_to_watch_out_for_when_writing_portable_shell_scripts/
> for what's involved in writing portable shell scripts.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list