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?

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.


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.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.