Solved

set history variable HISTTIMEFORMAT in Unix Bourne & Korn Shell

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

705 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

18 Experts available now in Live!

Get 1:1 Help Now