Using HTML inside shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using HTML inside shell script
# 1  
Old 06-17-2015
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.

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

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

Moderator's Comments:
Mod Comment Please wraps all code, files, input & output/errors in CODE tags.
It makes it easier to read, but also preserves multiple spaces for indenting or fixed width data

Last edited by rbatte1; 06-17-2015 at 12:53 PM.. Reason: Added CODE tags for output
rogerben
# 2  
Old 06-17-2015
Hello rogerben,

Following is an example for same, may help you.
Code:
 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
# 3  
Old 06-17-2015
Quote:
Originally Posted by rogerben
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.

Code:
#!/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>
Do you mean that you wish to display the text in Calibri, in terminal?
# 4  
Old 06-17-2015
Your script:
Code:
#!/bin/ksh
echo '<html>'
echo '<font face='Calibri' size='3'> JobName Status</font>'
echo '</html>'

Try:
Code:
abovescript.ksh > mypage.html
firefox mypage.html

hth
# 5  
Old 06-18-2015
Quote:
Originally Posted by Corona688
Do you mean that you wish to display the text in Calibri, in terminal?
Not exactly the font but whatever other html options need to display in terminal.
rogerben
# 6  
Old 06-18-2015
Quote:
Originally Posted by rogerben
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
# 7  
Old 06-18-2015
Reminds me, i happen to describe TUI metaphoricly as CSS if the terminal was a HTML page.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

2. Shell Programming and Scripting

Help in using html in Shell script

Hi, I made a script that displays various fileds of report that are required in csv format and send it on mail(the csv file). Now I want to convert the csv format into html table and then send it on mail. Reports_Output.csv Code:... (6 Replies)
Discussion started by: Supriya Singh
6 Replies

3. Shell Programming and Scripting

expect script inside shell script not working.

Shell Scipt: temp.sh su - <$username> expect pass.exp Expect script: pass.exp #!/usr/bin/expect -f # Login ####################### expect "Password: " send "<$password>\r" it comes up with Password: but doesnt take password passed throguh file. (2 Replies)
Discussion started by: bhavesh.sapra
2 Replies

4. Shell Programming and Scripting

SHELL SCRIPT AND HTML

Hello I'm trying to develop a shell script that executes commands such as cat / etc / fstab uname, etc. ..... which generates me an output file format html own way. Currently the shell script with the commands there, I have some notions of html but the generation of my html file is not clean at... (2 Replies)
Discussion started by: ddtseb
2 Replies

5. Shell Programming and Scripting

how to run shell script inside expect script?

I have the code like this : shell script continues ... .... expect -c" spawn telnet $ip expect "login:" send \"$usrname\r\" expect "Password:" send \"$passwd\r\" expect "*\>" send \"$cmdstr\r\" ... (1 Reply)
Discussion started by: robbiezr
1 Replies

6. Shell Programming and Scripting

Call a perl script inside a shell script

Hi all, I have the following snippet of code.. #!/bin/sh echo "run perl script............" #Run the verification script perl bill_ver echo " perl script completed....." echo "rename files......" #Remove from all file in the directories test, test1, test2, test3 for f in... (3 Replies)
Discussion started by: chriss_58
3 Replies

7. Shell Programming and Scripting

invoking a shell script inside cgi shell script

Hi, I have an HTML form through which I get some text as input. i need to run a shell script say script.sh inside a perl-cgi script named main_cgi.sh on the form input. I want to write the contents of the form in a file and then perform some command line operations like grep, cat on the text... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies

8. UNIX for Dummies Questions & Answers

Unix Shell Script along with .HTML

Hi, I need to know how to interact the unix shell script along with a .html. For example, I have a code like: #! /bin/sh exit_err() { print "Content-type: text/html\n" print $1 exit } toolbin/gu -i -r 'm_who(user,group,role,name,addr,phone)' > /tmp/temp.txt... (3 Replies)
Discussion started by: ronix007
3 Replies

9. Shell Programming and Scripting

Converting Shell Script to HTML

Hi, Im new to shell scripting. My task is to convert shell script feed into html, so basically I have a lot of information in shell script and I want to convert it html. I know you can simply convert the information by hand, but is there any simpler way? Thank you Dave (3 Replies)
Discussion started by: davwel
3 Replies

10. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies
Login or Register to Ask a Question