Solved

set history variable HISTTIMEFORMAT in Unix Bourne & Korn Shell

Posted on 2010-08-25
2
1,801 Views
Last Modified: 2013-12-26

Is there any way I can set the following variable in Bourne Shell (in /etc/profile) :
 export HISTTIMEFORMAT="%A  %Y-%m-%d  [%T %z]

Basically when I issue "history" or look into $HOME/.sh_history for each single userid,
I need the history-logged commands to be date+time stamped.

This can be done in Bash (Bourne Again shell) but what I want is for Bourne & Korn
shells.

It's not an option for me to change the existing users' Shell to Bash


I'm working on HP-UX B11.11 & various RHES/RHEL version 3, 4 & 5
0
Comment
Question by:sunhux
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 350 total points
ID: 33520616
Hi,
ksh doesn't have HISTTIMEFORMAT.
Try setting EXTENDED_HISTORY=ON in your .profile or in /etc/profile.
Please note that you will have to use "fc -t" to display the timestamps!
wmp
 
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 150 total points
ID: 33520787
Bourne shell has no history mechanism.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question