Shell chauvinism ;-D, was Re: popen4 doesn't block?
Terry Hancock
hancock at anansispaceworks.com
Fri Jan 24 20:28:34 EST 2003
Donn Cave wrote:
> Secondly, I think you would be better off to use 'sh' as the shell
> (and of course use Bourne shell syntax in the shell commands --
> ">& megane.log" -> "> megane.log 2>&1".) sh is universally supported
> on UNIX and similar platforms, and it's ordinarily better software
> than tcsh for anything but interactive use (if that.)
It's a funny thing, these cultural biases: I learned Unix as an astronomy
student, and have worked in astronomy departments and institutions of one
kind or another for most of my career (about 15 years?). I have *never*
seen a sh/bash script written by any one of my colleagues, *never* seen a
computer that didn't have csh or tcsh installed, and *never* worked for a
site that didn't install csh or tcsh *by default* for all users.
For the first time, last year I saw a sh script provided as an
*alternative* for installing astronomical software. Also, despite
assurances from CS types that tcsh should *never* be used as a programming
language, I have seen multi-thousand line installation scripts written in
it. In fact, I think perl is probably more common than sh here (of course,
Larry Wall used to work for my present employer back when he wrote perl).
So, really, in my world, tcsh is a stronger standard than sh is. I've
often wondered how this rift came to be, and who exactly it is that uses sh
all the time, and why it never caught on with the groups I've been in.
Whether this is, in absolute terms, a good thing, is a separate issue, but
it will definitely make my client happier to be able to read what the
script does. ;-D
I'll consider it anyway, though, as this script *is* meant to go further
than the astronomical community. I've often wondered how this rift came to
be, and who exactly it is that uses sh all the time, and why it never
caught on with the groups I've been in.
Also, is there a shell-interpreter implemented in Python? It'd be kind of
cool to be able to run a multi-line script and interpret each instruction
in the *same* sub-process (i.e. keeping state between them). My first go
at this was using os.system() to do that, but then I realized I was getting
a new process each time, so that:
os.system("cd mysubdir")
os.system("do_something_in_mysubdir")
didn't make any sense.
I realize that in a limited sense, the python interpreter itself could be
considered so, but:
os.chdir("./Log")
lacks something in both clarity and brevity against
cd ./Log
Anyway, thanks for the ideas!
Cheers,
Terry
--
Anansi Spaceworks
http://www.anansispaceworks.com
More information about the Python-list
mailing list