Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW TO CHANGE .sh_history on IBM AIX 4.3 ?

Status
Not open for further replies.

TheRealUncleVan

Technical User
Jul 19, 2004
3
NL
Hallo all together!

Recently I decided to introduce a new ksh history file for each and every working day (on an IBM AIX using the ksh). IBM states, that setting up something like:

HISTFILE=~/.hist$$

would provide you with a history file on a session basis.

And guess what ? - It doesnt work! Neither change of the HISTFILE takes effect. The Korn Shell simply doesnt log any history, if HISTFILE is set to another name then the default - ".sh_history" -, regardless of folder and file settings.

Any help from anybody ?

Thanx!

 
Try something like this in your .profile:
[ -z "$HISTFILE" ] && {
export HISTFILE="your new history file"
exec $SHELL -o nolog
}

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
why not rename the standard file to
file.julianday.$$
just before logout (last line in .profile) ?
 
Thanks so far,

OK, here the full story:
We are supposed to set user specific things in
ENV=~/.kshrc
So, though (only!) the PHVs Solution works, its not applicable.
What I found out till now:

.) The new $HISTFILE setting takes effect only if in the ".profile", and still there must be an "exec $SHELL" after the exprot, which I really dont get; seems to be an workaround, docs say nothing about it.

.) Through the "exec" I get all aliases defined so far lost, and we use them heavily

.) You CAN'T set it after the ".profile" has being processed - which is the actual problem - even not with "exec".

Im looking for further solutions and will apreciate any help.

Your UncleVan.
 
with "export ENV=~/.kshrc" in my .profile,

export HISTFILE=.sh_hist.$$

in .kshrc works just fine (AIX 4.3.3 KornShell), no "exec $SHELL) needed.

What do you mean by "You CAN'T set it after '.profile' has being processed"? Do you get some sort of "read only" warning?





Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
No, I dont actually get any error message. Even when I echo (or print) the $HISTFILE it says my new value; nevertheless the history doesnt use it!
The "exec $SHELL" seem to be the only option for now.

Look at what I lately found:

++++++++++++++++++++++++++++++++++++++++++++++++
Q1.How do I get separate history files for shell?

A1.ksh uses a shared history file for all shells that
use the same history file name. This means
that commands entered in one window will be seen by
shells in other windows. To get separate windows,
the HISTFILE variable needs to be set to different name
before the first history command is created.
++++++++++++++++++++++++++++++++++++++++++++++++

But when it uses to be so far?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top