setting font color in history file. (88 Views)
Reply
Advisor
madhucertify
Posts: 21
Registered: ‎09-01-2013
Message 1 of 5 (88 Views)

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

 

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,628
Registered: ‎06-21-2000
Message 2 of 5 (76 Views)

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.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,381
Registered: ‎03-06-2006
Message 3 of 5 (66 Views)

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.

Please use plain text.
Advisor
madhucertify
Posts: 21
Registered: ‎09-01-2013
Message 4 of 5 (50 Views)

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

 

 

 

 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,381
Registered: ‎03-06-2006
Message 5 of 5 (45 Views)

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/

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation