The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 09:02 AM
csh History aladdin UNIX for Dummies Questions & Answers 8 01-25-2008 06:39 AM
History JuniorJack UNIX for Dummies Questions & Answers 2 06-02-2005 04:37 AM
Any History igorsch Linux 1 09-25-2004 12:45 PM
history tselvanin UNIX for Dummies Questions & Answers 2 09-23-2003 03:40 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 10-18-2001
vince_ascend vince_ascend is offline
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
  #2 (permalink)  
Old 10-18-2001
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
env variable HISTSIZE for ksh
  #3 (permalink)  
Old 10-18-2001
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
I think Optimus_P meant HISTFILE rather than HISTSIZE. See the Korn Shell FAQ.
  #4 (permalink)  
Old 10-18-2001
vince_ascend vince_ascend is offline
Registered User
  
 

Join Date: Oct 2001
Posts: 2
Bingo! That's exactly what I'm looking for. Thanks a lot Perderabo.
  #5 (permalink)  
Old 10-19-2001
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
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
#****************************************
  #6 (permalink)  
Old 11-08-2001
Rado1x Rado1x is offline
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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0