![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| history | mirusnet | Shell Programming and Scripting | 1 | 01-27-2008 06:02 AM |
| csh History | aladdin | UNIX for Dummies Questions & Answers | 8 | 01-25-2008 03:39 AM |
| History | JuniorJack | UNIX for Dummies Questions & Answers | 2 | 06-02-2005 01:37 AM |
| Any History | igorsch | Linux | 1 | 09-25-2004 09:45 AM |
| history | tselvanin | UNIX for Dummies Questions & Answers | 2 | 09-23-2003 12:40 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
history in ksh
Sometimes out of necessity, we have more than one user logged into the same unix account. I like to repeat previous commands. Since the commands for all users logged into this account go into a common history, this can be a problem. if I'm not careful I can run a command I don't intend to run.
Yesterday I accidentally ran an "exit" command--annoying, but not serious. However, it hit me that if the other person used an "rm" command it could have been very serious. Does anyone know if there's a way to turn off the common history and only have commands in the history from that login session? Much appreciated, Vince |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
env variable HISTSIZE for ksh
|
|
#3
|
||||
|
||||
|
I think Optimus_P meant HISTFILE rather than HISTSIZE. See the Korn Shell FAQ.
|
|
#4
|
|||
|
|||
|
Bingo! That's exactly what I'm looking for. Thanks a lot Perderabo.
|
|
#5
|
||||
|
||||
|
users with one ID
If this is an application ID, I have a solution for you. This is not my script, but I offer it to you.
Set your login shell to /usr/bin/nologin for this shared user. Next, login as yourself then su - username. Use a script, put this in your .profile for the application, like this one below to keep track of individual history files. When you su to root or an application ID this is great! Remember put this in your .profile for root or application .profile. #*************************************** # sets .sh_hist file to id of user if [ "`tty`" = "/dev/console" ] then REAL=console else REAL=`logname` fi HISTFILE=$HOME/.sh_$REAL export HISTFILE HISTSIZE=1000; export HISTSIZE #****************************************
__________________
My brain is your brain |
|
#6
|
|||
|
|||
|
Another approach is:
HISTFILE=$HOME/.histfile.$$ which create unique histfile for each login shell. In this case, problem is that user don't see his history from previous log-in and you have to delete this files during log-out process. If you use csh [and clones], put rm $HISTFILE in your .logout If you use sh [and clones], try something similar in your .profile trap 'rm $HISTFILE; exit' NULL |
|||
| Google The UNIX and Linux Forums |