(patch for Bash) adding Python features to Bash

Donn Cave donn at drizzle.com
Thu Feb 13 23:59:07 EST 2003


Quoth Rene Pijlman <reageer.in at de.nieuwsgroep>:
| Dennis Lee Bieber:
...
| >        Part of what you want is REXX 
|
| But if _all_ of what I want is Python, I ask again, why would
| anyone want to use REXX and worry about how to Pythonize it?
|
| Are these languages (bash, REXX) really more powerful for shell
| scripting (WTMB) than Python?

You need another "WTMB" after "more powerful".  Python can do
anything the shell can do and lots more, so literally it's more
powerful, but the shell can be much more efficient, not just in
computer resources but your own programming time as well.

The UNIX shell (bash or any Bourne shell) is in the strictest
sense a UNIX scripting language, it was designed for that role
alone and serves in that role with an economy of expression that
no more general language can hope to match.  Its power is that
you can do a lot with a few very simple constructs.  Python is
a "scripting" language only in the (not very useful) sense that
it's used for casual programs.

But it doesn't have much going for it for data structures, or
data analysis.  You can consider awk et al. as part of the shell,
and awk can do that stuff - but then it's still kind of a mess
getting the results back out into the shell.  At some point the
Python route becomes more economical.

REXX has some good points, especially I like its PARSE statement,
but in my opinion it isn't good enough to justify the trouble.
If you're going to do UNIX, it's really fairly important to learn
the shell anyway, it's the always-installed lingua franca of UNIX.
If you're going to implement complex programs, you'll want to do
that in Python anyway - REXX's "stem" data structure can't be passed
around between functions/procedures, for an example of why it's not
really for serious software engineering.  So it's hard to imagine
how it would be worth dragging in REXX, unless you happen to already
have a big investment in it.

On the other hand, if it's just for fun, don't forget "rc" -
http://www.star.le.ac.uk/~tjg/rc/  It's the supreme UNIX shell,
actually written by the Bell Labs crowd for their later Plan 9
operating system and then ported back to UNIX.  Spartan but elegant.

	Donn Cave, donn at drizzle.com




More information about the Python-list mailing list