0

Hi,

I am writing my output using printf(...) procedure. Sometimes I would
like to use bold font.like this

interface(.... turn bold on :-) .....)
printf("something in bold\n");
interface(.... turn bold off :-) ....)
printf("something not in bold\n");

Is any way to do this?
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by cfajohnson
0

You can do that like this:

setterm -bold on

--> bold mode on

setterm -bold off

-->bold off
try:

man setterm

or

info setterm

for more information.

0


The setterm command is not standard.

Standard, but not implented consistently across platforms is tput.

Both of those commands are designed to work with any type of terminal (as specified by the TERM variable).

However, the plethora of terminal types has, for all intents and purposes, been reduced to a single, standard type. This standard, ISO 6429 (also known as ECMA-48, and formerly known as ANSI X3.64 or VT100), is ubiquitous, and terminals that do not support it are few and far between. As a result, it is now feasible to code for a single terminal type. One advantage of this homogeneity is that the necessary coding can be done entirely within the shell. There's no need for any external command:

message="Hello, World!"
printf "\e[1m%s\e[0m\n%s\n" "$message" Goodbye.

Edited by cfajohnson: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.