Using HTML inside shell script

Hi,
Am trying to use HTML tags inside my script but its not printing the required output. Any idea how to use html inside script will be helpful.

#!/bin/ksh
echo '<html>'
echo '<font face='Calibri' size='3'> JobName Status</font>'
echo '</html>'

Output

<html>
<font                       face=Calibri  size=3>     JobName   Status   </font>
</html>

Hello rogerben,

Following is an example for same, may help you.

 cat test_html.ksh
echo "<html>" > TEST_TEST
echo "<body>" >> TEST_TEST
echo "<table border="4">" >> TEST_TEST
echo "<tr>" >> TEST_TEST
echo "<td>" >> TEST_TEST
echo "R. Singh" >> TEST_TEST
echo "</td>" >> TEST_TEST
echo "<td>" >> TEST_TEST
echo "Singh is King" >> TEST_TEST
echo "</td>" >> TEST_TEST
echo "</tr>" >> TEST_TEST
echo "</table>" >> TEST_TEST
echo "</body>" >> TEST_TEST
echo "</html>" >> TEST_TEST
 
cat - TEST_TEST <<EOF | /usr/sbin/sendmail -oi -t
To: chumma@chumma.com
Subject: "Testinglah"
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF
 

Thanks,
R. Singh

Do you mean that you wish to display the text in Calibri, in terminal?

Your script:

#!/bin/ksh
echo '<html>'
echo '<font face='Calibri' size='3'> JobName Status</font>'
echo '</html>'

Try:

abovescript.ksh > mypage.html
firefox mypage.html

hth

Not exactly the font but whatever other html options need to display in terminal.

I think you are mixing up different layers of representation here.

HTML is a description language and code written in this language has to be interpreted by a program understanding the language to be carried out. These programs exist and are usually called "web browsers". Basically a web browser is a program able to create and operate network connections on one side (like telnet, ssh, ftp, and many others do too, but using a different protocol - http) and an interpreter which "reads" the data transferred this way - HTML documents - and renders it to its graphical representation on the other side.

It could also just spew out the raw data instead - this is what "batch browsers" like cURL or wget do - or limit the rendering process to simple text - these are text-mode browsers like lynx.

In any case, there is no reason why a terminal (or terminal emulation program) should interpret (render) any HTML-data. It won't interpret C-code or any other program either. There are special programs for that - C-Compilers for C-code, browser software for HTML, and so forth.

If you want to use extended formatting capabilities in a terminal (coloured text and the like) you need to either use so-called "termcap" (terminal capabilities database) functions (see the man page for "tput" and generally the keyword "termcap" and "terminfo" to learn more), or use the "curses" library, which does that for you. Another option is to - instead of using shell scripts in a terminal - use Tcl/tk, which is a scripting language similar to the shell but bringing its own graphical environment with it.

I hope this helps.

bakunin

Reminds me, i happen to describe TUI metaphoricly as CSS if the terminal was a HTML page.