Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How to generate HTML page from UNIX script out-put?

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 03-01-2013
HHarsh HHarsh is offline
Registered User
Join Date: Mar 2013
Last Activity: 6 September 2017, 10:19 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
How to generate HTML page from UNIX script out-put?

Hi All.

This my first post to this forum, and i assuming it will be best out-of all.

I am quite new to Unix scripting so please excuse me for any silly questions -

I am trying to create on Unix script in which it telnet to my server, check the connectivity of the server and then it generate the out-put.

I am getting correct output and everything is fine.

Now i want to extend that to some extend -

Now i want to the output of the script i should get in HTML formats in email.

conct_asap () {
cd ${home}
 telnet 40003 >tap <<EOF
conct_asap 2>asap.log 1>asap.log

grep "Connected" ${home}/asap 2>/dev/null 1>/dev/null
if [ $? -eq 0 ];then
 echo "1]. ${bold}ASAP Check${unbold}"
 echo "_________________________________"
 echo "Connectivity --> UP and Running"

So will it possible to generate HTML out-put and send to my mail box ?Linux

Moderator's Comments:
How to generate HTML page from UNIX script out-put? edit by bakunin: two thirds of your post were redundant FONT-, SIZE-, and whatnot-tags, which i just cleared out. Many thanks for creating that work for me, i wouldn't know what to do the whole day otherwise. The only tag you should have used - the CODE-tag - was missing, so i put it in. Was there anything not understandable in "Please use CODE-tags"? Or was it the button for the CODE-tag, which is so deceptively labeled "CODE"?

Last edited by bakunin; 03-01-2013 at 11:02 PM..
Sponsored Links
Old Unix and Linux 03-01-2013
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
Join Date: Jan 2012
Last Activity: 23 October 2017, 7:46 PM EDT
Location: Galactic Empire
Posts: 3,571
Thanks: 253
Thanked 1,300 Times in 1,219 Posts
Try something like:

     echo "<html><body>"
     echo "1. &nbsp; <b>ASAP Check</b><br>"
     echo "<hr><br>"
     echo "Connectivity --> UP and Running"
     echo "</body></html>"
} | mailx -m -s "Subject 
Content-Type: text/html" user@domain.com

Sponsored Links
Old Unix and Linux 03-01-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
Join Date: May 2005
Last Activity: 23 October 2017, 2:22 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 5,614
Thanks: 106
Thanked 1,598 Times in 1,176 Posts
In the function you write a file "tap" which you never use subsequently. Instead you use a file "asap.log", which should be filled with the <stdout> of the function, but there is none, as the only possible output is redirected to "tap".

Your script contains severe syntax errors ("if" without a closing "fi") and can never have run the way you present it.

Look at any HTML-document and you will notice that it is clear text with a fixed structure and tags mixed with the text. Search the web for any HTML reference (there is an abundance of them) and most of them will not only explain the general structure of such an HTML file but also the meaning of every tag. Consult such a reference/introduction and write such a file using "print" (if you use ksh) or "echo" (if you use bash) or whatever output command your shell has - finished.

I hope this helps.

Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to Use a UNIX Shell Script to Create an HTML Web Page? rami abusweilei AIX 12 12-26-2012 07:05 AM
Script To Generate HTML output Siddheshk Shell Programming and Scripting 2 11-13-2012 10:53 PM
Login page in html on unix ravi18s Web Programming 13 07-21-2009 10:52 AM
how to generate html file using script? kittusri9 Shell Programming and Scripting 2 05-25-2008 11:38 PM
Html web page to Unix Connectivity abhilashnair UNIX and Linux Applications 1 03-06-2008 09:13 AM

All times are GMT -4. The time now is 12:00 AM.