[TUHS] Book Recommendation [ reallly inscrutable languages ]

Bakul Shah bakul at iitbombay.org
Thu Nov 18 08:36:48 AEST 2021


On Nov 17, 2021, at 11:12 AM, Norman Wilson <norman at oclsc.org> wrote:
> 
> Wasn't Perl created to fill this void?
> 
> Void? I thought Perl was created to fill a much-needed gap.

and tcl, rc etc.

I just want better builtin support for shell pipelines as
they are essentially (flat) list processors! As an example
consider something like the following:

find . -name '*.[hc]' -type f | \
xargs grep -l '\<foo\>' /dev/null | \
xargs grep -l '\<bar\>' /dev/null | \
xargs some-command

Just to run some-command on all *.[hc] files with words
foo & bar. And this will fall apart if there are spaces
or : in filenames. Basically most scripts are about
enumerating, filtering, converting and processing. If
files, especially text files, are so central to unix,
a shell should know about them and provide common
operations on them. One can even think of shell variables
as files (sort of like the env device in plan9). If you
want to name some sub-computation instead of processing it
all in one pipeline, it should be trivial but it isn't;
you have to find uniq names for these temp files and remember
to delete them when done. I want lexically scoped variables
(aka files) that disappear once you exist the scope!

The difficulty is in coming up with an intuitive, regular
& a relatively concise syntax. Even so it would likely be
unpopular since people seem to prefer for-loops!



More information about the TUHS mailing list