Bold Characters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bold Characters
# 8  
Old 10-20-2009
Quote:
Originally Posted by rajeshorpu
Hi,

It not working it is giving me unusually result. please find below

What is not working?

What command are you using?

What terminal or terminal emulator are you using?
Quote:

This word is  bold  and this is not

It is not making bold as bold

i am using k shell.
# 9  
Old 10-20-2009
In my opinion you should never embed control strings like "\e[1m" in your code or shell scripts. You are making
assumptions about the terminal which will be displaying the output. It is not portable and can lead to problems
on multi-byte codesets and legacy and specialized terminals.

If you want to be in complance with ISO 6429/ECMA-48, the correct control sequences are CSI SGR0 for default
output and CSI SGR1 for bold (increased intensity) output. See Section 8.3.117 (SGR - SELECT GRAPHIC
RENDITION) of either standard. In partical terms these translate to the terminfo capabilities "bold" for
bold and the capability "sgr0" for default.
# 10  
Old 10-20-2009
Quote:
Originally Posted by fpmurphy
In my opinion you should never embed control strings like "\e[1m" in your code or shell scripts. You are making
assumptions about the terminal which will be displaying the output. It is not portable and can lead to problems
on multi-byte codesets and legacy and specialized terminals.

It is more portable than the alternative, tput.

Terminals or terminal emulators which do not use ISO 6429/ECMA-48 are very rare.
Quote:
If you want to be in complance with ISO 6429/ECMA-48, the correct control sequences are CSI SGR0 for default
output and CSI SGR1 for bold (increased intensity) output. See Section 8.3.117 (SGR - SELECT GRAPHIC
RENDITION) of either standard. In partical terms these translate to the terminfo capabilities "bold" for
bold and the capability "sgr0" for default.

The control sequence CSI SGR0 is "\e[0m".
# 11  
Old 10-20-2009
Quote:
Originally Posted by cfajohnson
The control sequence CSI SGR0 is "\e[0m".
but only in 7 bit encoding.
The standard defines it to be "\2330m" in 8 bit encoding. However, while both works fine with xterm, gnome-terminal is failing to properly interpret the latter even when configured to use UTF8 so IMHO sticking with "\e[0m" is more portable than strictly sticking to the ISO/ECMA standard and far better than relying to tput unless a very exotic terminal is used.
# 12  
Old 10-20-2009
I could count on one hand the number of times I've wanted to use bold, and on fewer hands the number of times I've had to.

Whenver I have, the tput has worked just fine.

We're talking of standards, this and ISO the other, but I tried both on numerous terminal types (including xterm) in Linux, AIX and in Solaris.

The tput version works 100% of the time.

The \e[0m method works fine in Linux, but not in AIX or in Solaris.

If it's a "standard", why doesn't it work here?
# 13  
Old 10-20-2009
Can you provide more context about the printf statement not working under AIX and especially Solaris ?
It certainly did work and still do for me with Solaris. In any case, the OS doesn't matter, what does is the terminal emulator you use.
# 14  
Old 10-20-2009
Hi jlliagre.

I used PuTTY, Exceed and (also via Exceed) dtterm (through CDE (on AIX)).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help getting rid of bold characters

Hi! So i've got this shell script that asks questions and the user is required to input answers. The answers typed are bold. sh-*.*$ sh filename dir cat question tput bold read ans tput sgr0 ... and so on tput sgr0 exit So when the script ends i don't get the bold characters... (3 Replies)
Discussion started by: Kingzy
3 Replies

2. Shell Programming and Scripting

Making Some Characters in file BOLD

Hi All, I want to make some characters to be bold in a file. I have a file e.g aa.log which contains rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr gfgfgdaerqrqwrqerqwrwqwrqrqwrqr qqwerqwrqwrqwrqwrqwrqwrqwrq qwrqwrqwrqwrqwrqwrqwrqwrqwr File is too large to view Last line... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

3. Shell Programming and Scripting

how to display in bold

Hi, i am using mailx option to send mail from unix In the body of the mail i want certain numbers to be displayed in bold Is there any way to do it If so, can anyone help me in this regard. (2 Replies)
Discussion started by: trichyselva
2 Replies

4. Shell Programming and Scripting

Bold characters in a file using Shell script

Hi, When I am running below mentioned script then the characters become bold but after opening the same file in Windows, Instead of getting bold characters i am getting some garbage value for \033Kunal Dixit Output in Windows (after ftp the file): but in windows , i am getting My name is... (0 Replies)
Discussion started by: kunal_dixit
0 Replies

5. UNIX and Linux Applications

Bold characters in mail

I sh, I have bold characters in a file and I want to mail file to an ID. $cat file Incorrect or invalid external email IDs in TO and CC list for email_rules: If I pass this file to mailx $ cat file | mailx -s "hi" abc@xyz.com What I get in mail is  (8 Replies)
Discussion started by: hemangi13
8 Replies

6. Shell Programming and Scripting

Bold characters in c shell

Hi, Can someone tell me how to display characters in Bold in C shell?? (9 Replies)
Discussion started by: hemangi13
9 Replies

7. Shell Programming and Scripting

color,bold

hi friend , I am generating a csv file i,e output file E104|0|06/04/1994|The values E005 and E001 are not equal. E106|0|01/09/1993|The values E001 and E002 are not equal. E106|0|01/09/1993|The values E003 and E002 are not equal. E108|0|02/30/1995|The values R001 and E001 are not equal.... (0 Replies)
Discussion started by: charandevu
0 Replies

8. Programming

Bold text

hello, how do i display the text in the printf statement in bold. or is there anyway to display the text on the console in bold thx in advance svh (3 Replies)
Discussion started by: svh
3 Replies

9. UNIX for Dummies Questions & Answers

Printing in Bold

Hi, How do I print some shell variable in BOLD/ Thanks for any suggestions, Preeti (10 Replies)
Discussion started by: preetikate
10 Replies

10. Shell Programming and Scripting

Bold the paragraph

Hi, I have a file with multiple paragraph. I want to look for some word and make that paragraph bold. How can I do that? Thanks, Karthik (3 Replies)
Discussion started by: caprikar
3 Replies
Login or Register to Ask a Question