The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-18-2001
Registered User
 

Join Date: Oct 2001
Posts: 2
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
Reply With Quote
Forum Sponsor
  #2  
Old 10-18-2001
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
env variable HISTSIZE for ksh
Reply With Quote
  #3  
Old 10-18-2001
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,656
I think Optimus_P meant HISTFILE rather than HISTSIZE. See the Korn Shell FAQ.
Reply With Quote
  #4  
Old 10-18-2001
Registered User
 

Join Date: Oct 2001
Posts: 2
Bingo! That's exactly what I'm looking for. Thanks a lot Perderabo.
Reply With Quote
  #5  
Old 10-19-2001
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
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
Reply With Quote
  #6  
Old 11-08-2001
Registered User
 

Join Date: Nov 2001
Posts: 35
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0