Operating System - HP-UX
1832568 Members
4529 Online
110043 Solutions
New Discussion

Re: show the character in colur

 
SOLVED
Go to solution
heaman1
Regular Advisor

show the character in colur

I have a shell script that output the text file and send to notes server , then I read the mail on notes , it works fine , can advise if I would like the text in the mail have the bold type and colur , what can i do ? thx

I tried the below method , but not work .

tput bold
echo "This"
tput sgr0 #Reset text attributes to normal without clear.
echo "This"


$ echo -e "\033[1mThis is a BOLD line\033[0m"
11 REPLIES 11
Dennis Handly
Acclaimed Contributor
Solution

Re: show the character in colur

I assume these are terminal escape sequences, not Microsoft ones.
Laurent Menase
Honored Contributor

Re: show the character in colur

did you try html tags precising mime type
BOLDred
heaman1
Regular Advisor

Re: show the character in colur

thx Laurent Menase ,

this seems a html code , but I am not familiar with it , can I use shell script to do it ? please advise
Laurent Menase
Honored Contributor

Re: show the character in colur

mail laurent <Subject:yo
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable






xxxxxx



  • xxxxxxxxxxxxxxxx








EOF
Steven Schweda
Honored Contributor

Re: show the character in colur

> Content-Transfer-Encoding: quoted-printable

Seems as if this does little other than
adding extra work (changing "=" to "=3D"
everywhere, and so on). Why do it (for a
plain-text e-mail message)?
George Spencer_4
Frequent Advisor

Re: show the character in colur

These work on a vt100 emulation, but try them out in your emulator.

ESC="\0033"

print -n "${ESC}[1;30m Black Text ${norm}\t ${ESC}[1;31m Red Text ${norm}\t\t"
print "${ESC}[1;32m Green Text ${norm}\t ${ESC}[1;33m Yellow Text ${norm}"
print -n "${ESC}[1;34m Blue Text ${norm}\t ${ESC}[1;35m Magenta Text ${norm}\t"
print "${ESC}[1;36m Cyan Text ${norm}\t ${ESC}[1;37m White Text ${norm}"

Find the manual for your terminal emulator, as this may give you a few ideas.
Dennis Handly
Acclaimed Contributor

Re: show the character in colur

>George: Find the manual for your terminal emulator

heaman1 said notes so I assume he has to make windows happy?
Steven Schweda
Honored Contributor

Re: show the character in colur

> [...] I assume he has to make windows happy?

It's not the OS which needs to be happy, it's
the program (or, I suppose, device) which is
used to display the e-mail message. If
that's a HTML-capable e-mail client, then it
makes sense to code the colors as HTML. If
it's a terminal (emulator), then it makes
sense to use terminal (emulator) control
codes.

As usual here, the problem statement lacks
sufficient information to determine the
actual problem, so we're left to guess (or
not).
George Spencer_4
Frequent Advisor

Re: show the character in colur

Oops! The reference to notes went over my head. I saw the mention of tput and echo, and assumed that he must be sending to a terminal emulator.

If he wants the coloured text in an e-mail, then you are right, in that he should use HTML. However, for the HTML to work, the mail must be sent as a MIME mail alternate mail format. The standard UNIX mail and mailx are unsuitable for sending the alternate formats used by MIME. If the HTML is sent in the body of a standard e-mail, it is not displayed as HTML. It also does not display, if sent as an attachment. A MIME mailer is the solution.
Dennis Handly
Acclaimed Contributor

Re: show the character in colur

>George: The standard UNIX mail and mailx are unsuitable for sending the alternate formats used by MIME. If the HTML is sent in the body of a standard e-mail, it is not displayed as HTML.

Laurent's mail solution works fine. (I'm not sure why? Except mail(1) may allow the body to contribute to the headers?) Using mailx(1) fails because there is a blank line. I'm assuming using sendmail would also work.
Dennis Handly
Acclaimed Contributor

Re: show the character in colur

>> [...] I assume he has to make windows happy?

>Steven: It's not the OS which needs to be happy,

By "windows" I originally had bill gates. The whole windows infrastructure, including outlook, etc.