bash Vs python ??

Anand Pillai pythonguy at Hotpop.com
Wed Nov 5 05:14:52 EST 2003


bash vs python?

Does it make sense to compare a rudimentary unix shell with
minimal capabilities to a powerful programming language
like python? I dont feel so. 

-Anand

Ville Vainio <ville.spammehardvainio at spamtut.fi> wrote in message news:<du7k76f1cw4.fsf at mozart.cc.tut.fi>...
> William Park <opengeometry at yahoo.ca> writes:
> 
> > It depends.  My guess is Bash would be more suitable for "automated
> > testing scripts", since you'll be calling lots of utilities.
> 
> os.system, os.popen family, pexpect...
> 
> In python it's much easier to process the output and produce the input
> of the utilities.
> 
> Bash is good for throwaway one liners, Python is good for scripts that
> you *gasp* save to a file and might also execute later. You never
> know, you might want to extend the testing system later on, perhaps
> developy advanced logging facilities etc. 
> 
> The shell has one advantage over Python, though: it can be executed in
> the environment of current shell (i.e. '. myscript.sh'), so you can
> change the environment variables in the surrounding environment. In
> python you would have to do 
> 
> export MYENVVAR = $(python calcvalforvar.py)
> 
> If that is what you need, you might want to use bash. Otherwise, use
> python. And even if you need that, you might want to generate the bash
> script in a python script.
> 
> A good rule of thumb is: The less non-python stuff you have around,
> the better. Non-python parts of any given system are invariably the
> ones causing most of the problems :-).




More information about the Python-list mailing list