What is 'expect'
Lars Henrik Mathiesen
thorinn at rimfaxe.diku.dk
Fri Nov 23 03:41:47 AEST 1990
lerman at stpstn.UUCP (Ken Lerman) writes:
>In article <1990Nov15.054937.27996 at midway.uchicago.edu> goer at quads.uchicago.edu (Richard L. Goerwitz) writes:
>[...]
>Shouldn't you write:.........................then I will most definitely
> want to use it in place of OTHER ugly conglomerations of sed, awk, and sh.
>No, I am not disparaging perl, because I don't know enough about it.
>But from the little I know about perl, I don't believe it solves what
>I perceive to be the problem. What we (or I) need is a simple,
>elegant, extensible tool that is easy to learn and use. Do people
>seriously claim that perl is it? If so, then perhaps it is time for
>me to spend some time with my perl manual.
Perl is a somewhat complex, somewhat kludgy tool which allows you to
do (almost?) everything you can do in a Bourne shell script using sed,
awk, test and expr. It is extensible in much the same way, by piping
to or from other programs.
It seems to me to have a good balance between simplicity and features,
and between elegance and usefulness. The goal, after all, is to allow
a system programmer to express the algorithms they need with a minimum
of fuss.
My first Perl script took me an afternoon of trying out versions with
manual in hand. It involved taking a list of names in upper case,
properly capitalizing them, and merging them into the gecos field of
the password file. In this case, I might have been able to make an awk
script in half the time, but next time I don't think Perl will be
harder to write for.
My feeling is that I will almost always be more sure of what a Perl
script means than of the meaning of a shell script of similar
complexity. A large part of this difference comes from the almost
quoting-free regular expressions and the ``unifying'' of testing and
control. And with the reputation of Larry Wall, I trust the core
features of Perl to ``do what it means'' at least as much as I trust a
4.3BSD awk, for instance.
So, elegant and simple: no. Simpler and easier to learn, write and
maintain than sh, sed, awk, expr, test: yes, indeed.
--
Lars Mathiesen, DIKU, U of Copenhagen, Denmark [uunet!]mcsun!diku!thorinn
Institute of Datalogy -- we're scientists, not engineers. thorinn at diku.dk
More information about the Comp.unix.shell
mailing list