Solved

set history variable HISTTIMEFORMAT in Unix Bourne & Korn Shell

Posted on 2010-08-25
2
1,696 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now