I keep a printed version of the Bash
manual handy so I'm curious about any changes made to it - especially since I don't always pay attention to the packages I update. Usually locally you have the version of the manual related to the version of the software you have, and you can track changes easily.
I built this to check some sources and have a summary:
#!/usr/bin/env bash
## bashmancheck - Check different sources for date of the last updates
header="BASH manual -- Local BASH manual -- BASH repo /doc -- BASH Reference man(www)"
data="$(links -dump 'http://git.savannah.gnu.org/cgit/bash.git/tree/doc/bash.1' | grep -om 1 'Last Change.*' | cut -d ' ' -f 4,6,9) -- $(zcat /usr/share/man/man1/bash.1.gz | grep -om 1 'Last Change.*' | cut -d ' ' -f 4,6,9) -- $(links -dump 'http://git.savannah.gnu.org/cgit/bash.git/log/doc' | grep -Eom 1 '[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}') -- $(links -dump 'http://www.gnu.org/software/bash/manual' | grep -om 1 'last updated.*' | cut -d ' ' -f 3-)"
cowthink -W80 -f bud-frogs -- $header $data
It uses links
and zcat
to look at a specific string in the manpages source online and locally, as well as in the /doc section of the Bash repository and finally in the online reference manual. And the output looks like this:
( BASH manual -- Local BASH manual -- BASH repo /doc -- BASH Reference man(www) )
( Feb 2 2014 -- Feb 2 2014 -- 2014-02-26 -- August 22, 2012 )
-------------------------------------------------------------------------------
o
o
oO)-. .-(Oo
/__ _\ /_ __\
\ \( | ()~() | )/ /
\__|\ | (-___-) | /|__/
' '--' ==`-'== '--' '
Yet I wish I had pairs of item and date each on a line, like so:
BASH manual: Feb 2 2014
Local BASH manual: Feb 2 2014
BASH repo /doc: 2014-02-26
BASH Reference man(www): August 22, 2012
But for that I would need to change line after I concatenate the item and its date - and I can't make happen it with cowsay/cowthink
. And this explains why I have designed the script like it is. The two variables are just there to help me out with formatting but have no bearing on it at execution. It just so happens that the header and data variables are less than 80 columns wide each and the command ouput is set to 80 columns for that purpose. I also used cut
to shorten the dates for them to display on one line instead of just using grep -o
like I was initially doing. I arbitrarily used some characters(double dashes) for formatting - which is just crude.
Can you use newlines with something like cowsay? Is there a (better) way to do this?
cowsay options --
what I put after -- was stdin? I guess I wasn't clear. I would have preferred to present the whole thing as combositem date \n
i.e. Bash manual date newline etc. – Jun 01 '14 at 09:27