[TUHS] A few comments on porting the Bourne shell
Alejandro Colomar
alx.manpages at gmail.com
Thu Jan 5 06:46:19 AEST 2023
Hello Bakul, Ralph,
On 1/4/23 19:01, Bakul Shah wrote:
> On Jan 4, 2023, at 7:19 AM, Ralph Corderoy <ralph at inputplus.co.uk> wrote:
>>
>> A lot of the time, POSIX find's ‘-exec foo {} +’ suffices and runs
>> foo with as many arguments as will just fit under argv[]s limits,
>> like xargs by default and unlike find's one-at-a-time behaviour with
>> ‘-exec foo {} \;’.
>
> I often run further transformations before executing
> some command on selected files. For example
>
> find . -type f -name '*.[csh]' | grep -l foo | xargs wc -l
I find find(1)'s options too complex. I prefer composing even more. I very
often find myself writing:
find . -type f | grep '\.[ch]$' | grep -l foo | xargs ...
>
> Composability rules!
Yup it does :)
For me, the only shell feature that matters is the pipe. I also like using
bash(1) for it's pipefail feature (and I also usually enable lastpipe). But
things like globbing and regex support, I don't like them at all.
I wish shells didn't supoprt globbing, and that glob(1) would be a standalone
program still today. It would simplify much of the quoting issues if most
characters were just characters to the shell.
Cheers,
Alex
More information about the TUHS
mailing list