Adages II: The Adagening [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Wed 2014-07-30 09:30
Adages II: The Adagening
LinkReply
[personal profile] gerald_duckWed 2014-07-30 09:41

I'd agree with everything… except your example of a wrong-defaults command.

While, sure, I'll often do find -print0 | xargs -0 I'll just as frequently be piping a file into xargs, or viewing find's output on-screen. If you want things to Just Work, I fear many other common Unix utilities would have to be re-vamped to work on files with entries delimited by nulls rather than newlines — things like less, sed, etc.

Either that, or make xargs line-oriented by default and prohibit newlines in filenames.

Realistically, I think the best one could hope for, rather than it just working, is an easier way to spell that. My preference would be a -xargs option to find.

Link Reply to this | Thread
[personal profile] simontWed 2014-07-30 09:44

I'm not really sure you're contradicting me – where did I say that if you constantly had to specify the 'work properly' option to find, something was necessarily wrong with find?

Link Reply to this | Parent | Thread
[personal profile] gerald_duckWed 2014-07-30 11:01

Well, a command where one always ends up some specific optionis, I agree, a command that should have better defaults. But both find and xargs, I sometimes use with those options, sometimes without. So I'm not sure what you feel should be improved about the situation, or how.

The reductio ad absurdam would be for the shell to have just one command: dwim (-8

Link Reply to this | Parent | Thread
[personal profile] simontWed 2014-07-30 11:45

Well, I haven't exactly worked out all the details either, as I'm sure you know perfectly well.

But it seems to me that it ought not to be beyond the wit of humankind to devise a system whereby the list of filenames output by find does not need to be explicitly specified every single time as being in one or another particular serialised representation, when that selection could in principle be automatically inferred by knowing the consumer of the data. Programming languages, for example, have a range of perfectly good mechanisms whereby you can return one type and also provide a default conversion to one or more other types for clients who would have preferred those, and then you don't have to write the conversions out longhand at every call site.

Link Reply to this | Parent | Thread
[personal profile] gerald_duckWed 2014-07-30 15:56

If there's a movement to have Unix commands output some form of structured data instead of a raw octet stream that is in many cases assumed to be textual, I just bet people would choose either MIME or XML.

I think I'd rather keep typing -print0 and -0 than take the risk!

Link Reply to this | Parent
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]