[Toybox] Looking at nl
Rob Landley
rob at landley.net
Mon May 27 08:26:57 PDT 2013
On 05/25/2013 11:08:51 PM, Terrel Shumway wrote:
> On Sat, May 25, 2013 at 5:36 PM, <idunham at lavabit.com> wrote:
> > I thought I'd look at what nl takes, since it's not much more than
> > looping over some lines, incrementing, and formatting the output.
> > The POSIX reference page is:
> > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nl.html
>
> An awk wizard could do that in less than a dozen lines. Since awk is
> already supposed to be in the toybox, why not write nl as a script?
I did a few commands as shell scripts, then decided it was a bad idea
and removed them. Go "hg log wrappers" to see the old (now-deleted)
directory. (I tried to beat that log out of the web interface, but
that'll only log files, not directories. Commits 411, 452, 596, 644.)
The problem (other than toysh and awk still being on the todo list) is
that toybox is a single binary. Statically linked, you can drop it on
an arbitrary system and use it, all by itself. The shell wrappers don't
bundle into the executable, require different install logic, use more
memory at runtime, and on most filesystems take up a full 4k per file
plus their own inode. It's fine having a project of wrapper scripts
that eliminate commands, but toybox isn't it.
> "Perfection is achieved, not when there is nothing more to add,
> but when there is nothing left to take away."
> -- Antoine de Saint-Exupery
Heh. I had that as my .sig for a year or so, a while back.
Rob
More information about the Toybox
mailing list