Thursday, November 8, 2007

Useful <PRE> tag

If you have a text file or a code block and you want to put quickly online and keep it's text format with spaces or tabs. You don't have to go through all the bother of adding and spacing it all out correctly. The easiest solution is to use the <pre></pre> tag which maintains a text format - line breaks and tabs.

#!/usr/bin/bash

if [ ! $# == 2 ]; then
echo "Usage: $0 <dbuser> <dbpassword>"
exit
fi

You still have to convert the following characters before put the code in <pre></pre> though:

& : &amp; [ & a m p ; a m p ; ]
< : &lt; [ & a m p ; l t ; ]
> : &gt; [ & a m p ; g t ; ]

No comments: