Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

setting font color in history file.

Advisor

setting font color in history file.

Hi,

 

for example when I execute

 

#lvlnboot -v

#rm -rf /tmp/testdir*

#chown user1:group1 /tmp/testdir

 

 

so when I check in history, all 3 commands executed will be updated.

 

for certain commands ,i need to change the  font color.

 

suppose who ever executes rm -rf ,it should be updated in history file in redcolor.

 

 

my sample history file

 

#lvlnboot -v

#rm -rf /tmp/testdir*

#chown user1:group1 /tmp/testdir

 

when ever rm -rf is executed,it should be updated in histroy file in red font.

 

-Madhu

 

4 REPLIES
Honored Contributor [Founder]

Re: setting font color in history file.

Not really possible.  The history file is only a list of commands that have been executed.  It's sole intended use was to provide an easy way to go back and recall commands that you previously ran.

 

It was never intended to be any sort of audit tool and does not have any flexibility to add highlights, dates/times, etc.

 

Font color will also depend entirely on the terminal emulator you are using.  A basic HP terminal specification can do things like blink, bold, reverse video, but no color.  And even those are not supported in the history file.

Acclaimed Contributor [Founder]

Re: setting font color in history file.

Anything is possible but you'll need to write a filter to add the color.  Kind of like the various "color" ls(1) commands.

Advisor

Re: setting font color in history file.

Hi Dennis,

 

>>but you'll need to write a filter to add the color.  Kind of like the various "color" ls(1) commands.

 

you mean to say,

 

everytime all user has  to execute something like

 

$03[] ls

 

03[]---indicates color font.

 

-madhu

 

 

 

 

Acclaimed Contributor [Founder]

Re: setting font color in history file.

> every time all user has  to execute something like

 

Actually something like chistory. :-)

Where chistory is a wrapper around history or fc.  You may want to look at the source to cls, to see how to add color.

http://hpux.connect.org.uk/hppd/hpux/Users/cls-1.8/