|
|
Describe all Unix apps in current PATH
You know, I hear people say how ugly Perl is, but let's compare the Perl equivalent to the massively messy thing just posted:
Not only that, but it probably runs hella faster. :)
Describe all Unix apps in current PATH
Oh wait, that's not hella faster, because it still invokes whatis repeatedly (and with a whitespace problem). This is hella faster:
Describe all Unix apps in current PATH
Well, formatting helps a little:
Greg Shenaut
Sorry, bash wins.
merlyn:
That's not faster at all. Even with an added command in bash (see below), 'time' reports: One caveat: that's bash 3.2.9 -- the latest, while perl remains at 5.8.7;bash real 0m44.014s user 0m11.898s sys 0m25.316s perl real 0m55.462s user 0m0.302s sys 0m0.172s ..the bash-code used an additional 'sed' to escape whitespacing in $PATH.
pedagogy
As a tool to produce the list of commands with descriptions, a pure Perl solution is obviously better. And that's probably how I would have done it had I started out to produce such a tool. But this complicated pipeline of commands started off life in a discussion about getting a list of commands in your PATH (with no descriptions) and grew from there.
pedagogy
I know this is 'old' news, but thanks for the script and BRILLIANT explanation of each step. I am revising for an exam which will require us to write pipelines, and this was most helpful! |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|