[sf-lug] much can be said for ... for i in /usr/share/man/man*; do man $i/*; done

GoOSSBears acohen36 at linuxwaves.com
Tue Aug 23 08:27:12 PDT 2016


First quoting Michael Paoli (Michael.Paoli at cal.berkeley.edu):
>> I like looking over stuff in the directories on PATH, for anything
>> in them that I don't recognize or not all that sure what it does or
>> what it's for - and having a look at the man page.  :-)
>> 
>> Have found some really cool stuff by such, or similar means.
>> E.g. tac(1) - so very handy.

Then quoting Rick Moen (rick at linuxmafia.com)
> Oh yeah.  Looking at the man pages for new discoveries 
> can be a heady and revelatory experience!

Well "RTFM ;)" certainly applies for tac(1).
I also don't think simple command line pipelines such as 'for i in /usr/share/man/man*; do man $i/*; done' would require much in the way of RTFM or further comments.

OTOH, it would certainly help readers a great deal if slightly more complex command line pipelines are better described elsewhere, e.g. clearing up what the lines of the pipeline found at http://linuxmafia.com/pipermail/sf-lug/2016q2/011832.html actually perform:
~~~~~~ quoting ~~~~~~
$ (for ns in $(dig -t NS github.com. +short | sort); do echo $(dig \
> @"$ns" +noall +answer github.com. A github.com. AAAA) "[$ns]"; done)
~~~~~~~~~~~~~~~~~~~~~

Of course we could delve through the 'dig' man page and *eventually* find out the description, purpose and actions of the above person's command line pipeline. 

More complex command line pipelines can eventually turn into actual scripts, as per the following from http://linuxmafia.com/pipermail/sf-lug/2016q2/011832.html :
~~~~~~ quoting ~~~~~~
#!/bin/sh
exec strace -fv -eall -s2048 ${1+"$@"}
$ 2>&1 Strace ping -c 3 github.com. | fgrep github | tail -n 1
recvfrom(3,  
".5\201\200\0\1\0\1\0\4\0\0\6github\3com\0\0\1\0\1\300\f\0\1\0\1\0\0\0R\0\4\300\36\374\201\300\f\0\2\0\1\0\2\215\340\0\24\3ns3\3p16\6dynect\3net\0\300\f\0\2\0\1\0\2\215\340\0\6\3ns1\300<\300\f\0\2\0\1\0\2\215\340\0\6\3ns4\300<\300\f\0\2\0\1\0\2\215\340\0\6\3ns2\300<", 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) =  
130
~~~~~~~~~~~~~~~~~~~~~

As there might not be many man pages for the entirety of scripts such as the above (if any at all??), I would rather suggest that sh/bash/dash scriptwriters *avoid* the "I'll leave it as an exercise for you to figure out ;)" syndrome and instead CYFS (=Comment Your Fine Scripts)
CYFS; it's a Good Thing!

-A





--
Go Open Source Software Bears!


_____________________________________________________________
Get your FREE, LinuxWaves.com Email Now! --> http://www.LinuxWaves.com 
Join Linux Discussions! --> http://Community.LinuxWaves.com




More information about the sf-lug mailing list