Solved

set history variable HISTTIMEFORMAT in Unix Bourne & Korn Shell

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

Independent Software Vendors: 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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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…
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.:
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…

740 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