Solved

set history variable HISTTIMEFORMAT in Unix Bourne & Korn Shell

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

856 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