Hi there

If you often have to write system documentations in mediawiki, you will love this bash function:

file2wiki(){
if [ $# -gt 1 ] ; then
   for f in $*
   do
      file2wiki $f
   done
fi

f=$1
echo "<div class=\"toccolours mw-collapsible mw-collapsed\" style=\"width:60%\">
File: <b>$1</b>
<div class=\"mw-collapsible-content\">
<pre>"
cat $1
echo "</pre>
</div>
</div>
"
}

 

usage example:

file2wiki /etc/motd /etc/sysconfig/iptables /etc/sysconfig/network-scripts/ifcfg-eth* /etc/sysconfig/network-scripts/route-eth* /var/spool/cron/* /usr/local/sbin/*