Re: [dev] less lines of code suck less

From: Jeremy <jer_AT_jer.cx>
Date: Mon, 3 May 2021 13:51:33 -0700

On 05/03/21 04:28PM, Greg Reagle wrote:
> Would sbase suck less if the program head, which is currently a C program of 77 lines, were replaced with something like
> #!/bin/sh
> sed "$1"q
>

Great job.

> I know that it would need to be a bit more elaborate than that to handle the -n flag, but still. Is there any advantage to having a separate C program?
>

The spec gets a bit tricky when handling multiple files - see:
seq 3 | awk '{ print $1 > $1 }'
head -n1 $(seq 3)

This is simple enough to do in awk, with very few lines of code.

I'd argue that requiring awk to use `head` would create more
complexity(for the end user) than it would solve for the developer.

Jeremy
Received on Mon May 03 2021 - 22:51:33 CEST

This archive was generated by hypermail 2.3.0 : Mon May 03 2021 - 23:00:09 CEST