Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: A little golf anyone?

by sauoq (Abbot)
on Oct 31, 2002 at 02:34 UTC ( [id://209314]=note: print w/replies, xml ) Need Help??


in reply to A little golf anyone?

Why go to all that trouble? The GNU fileutils package compiles neatly on Solaris 8.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^2: A little golf anyone?
by Aristotle (Chancellor) on Oct 31, 2002 at 07:37 UTC
    Pfff, party pooper. :^) C'mon, you know you want to. ;-)

    Makeshifts last the longest.

Re: A little golf anyone?
by deprecated (Priest) on Nov 01, 2002 at 14:53 UTC
    I'm aware that GNU fileutils compiles cleanly on Solaris 8. That, however, implies that one has a compiler, or that one is willing and/or able to add packages to the system.

    The fact of the matter is, I'm trying to apply a global configuration to a lot of machines, most of which do not have more than 540mb of internal disk space.

    These machines have perl. They do not have gcc or forte, and it would take a long time to compile these packages, and it simply isnt reasonable to go and install a package to do that. It is much easier and practical to insert a

     du | perl
    ism into my .profile.

    I wanted also to say that this reminds me a lot of the typical irc #perl channels.

    <user> how can i accomplish X? <chanop> why on earth would you want to accomplish X? you can do Z ins +tead! <user> because Z isn't relevant at all to what I want to do.
    this kind of response is just rampant on IRC and on mailing lists, and I even see it here. It bothers me because these answers pollute search engines like Google. When somebody is searching for an answer on how to, say, format a file into six columns with perl, they're going to find ten answers from the chanop/listmaven type saying "just use
    fmt(1)
    rather than explaining what they need to do." Far more effective than telling somebody something else they can do is to answer the question and point them in another direction that would help.

    I've bitched about this in the past, but its been a year or so, so I'm inclined to bring it up again.

    brother dep

    --
    Laziness, Impatience, Hubris, and Generosity.

      You forgot the rest of that irc conversation:

      <chanop> Why isn't Z relevant? <user> Because Y. <chanop> But Y isn't a good reason. Let me explain... [dozens of lines of explanation snipped] <user> Oh. Maybe I should try Z...
      At least, that's how it used to be on OPN/#perl when it was still relatively small and friendly.

      So, you were bothered by my reply. I'm left wondering why you were bothered that I asked: "Why go to all that trouble?" and then added "The GNU fileutils package compiles neatly on Solaris 8." as an explanation. Perhaps you feel underestimated. Perhaps you think that when you ask a question I should assume that you know what you are doing and not question your enlightened approach. You might even be right but its a rather ungracious attitude to have when you are seeking help.

      You complained about the answer I gave you when, in fact, my response wasn't intended to be an answer at all, but a probe for more information. Since you seem taken aback by it, I'll explain why I questioned you. In your original post you wrote:

      (the principle being, if youre going to do it a bunch of times, you want it to be fast)

      You want it to be fast. Fine, we'll ignore that you want to start up a perl interpreter for this... But why ask for a golfed solution? Short doesn't mean fast and the shortest solution for many problems is far slower than the fastest. Asking for the two things together is kind of, uh, green. Because you want it to be part of a shell alias isn't, by itself, a good justification for a golfed solution either. Shortish may be nice, maybe, but why golfed? Admittedly, it's ugly in tcsh but if you are using tcsh you are probably used to doing ugly things similar to:

      alias blahblah 'du | perl -e '\''\\ ... \\ ... \\ ... \\ '\'

      If, on the other hand, you did decide to use GNU du/df binaries, they weigh in at about 45k (stripped) each. I don't think they rely on special libraries, so you wouldn't have to install a package, you'd probably just have to copy the binaries around. (If you really have a lot of machines, NFS would probably make life easier.) Not only are they fast, they provide additional functionality and unlike shell aliases, they can be reliably called from scripts.

      Shell aliases are useful for many things but I wouldn't use one for this because it seems to me like too much complexity for too little gain. I would either use the GNU versions or get used to reading long numbers. (In fact, I have many gnu tools in my ~/bin which is automounted on most of the machines I work on but I tend to just use -k with df/du even though our arrays have 150Gb+. It comes pretty easily after a bit.)

      If you really insist on using aliases, I recommend against calling them "du" or "df" because you'll get frustrated all over again when you regularly find the need to use the commands with other switches like df -e or du -L.

      Back to the point...

      In your sig, you list "Generosity" along with the three great virtues of a programmer. I don't know that it really takes generosity to be a great programmer but it is certainly a quality worth having. Another one is humility. Humility enables us to truly accept the generosity of others.

      -sauoq
      "My two cents aren't worth a dime.";
      

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://209314]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-11-10 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    chatterbot is...






    Results (37 votes). Check out past polls.