[comp.unix.questions] why doesn't command history work for user root?

mdorion@cmtl01.UUCP (Mario Dorion) (06/06/88)

Can anyone explane to me why doesn't command history work for user root?

I onced looked at the sources of the korn shell and it says something like:
(this is just from memory)

if (userid != 0 )     /* no history for root */
  {
    blah; blah; history processing stuff;
  }

Why?

Also, the 'jobs' command does not work that well either for root.
-- 
     Mario Dorion              | ...!{rutgers,uunet,ihnp4}!     
     Frisco Bay Industries     |            philabs!micomvax!cmtl01!mdorion
     Montreal, Canada          |
     1 (514) 738-7300          | I thought this planet was in public domain!

ado@elsie.UUCP (Arthur David Olson) (06/09/88)

Okay gang. . .the REAL scoop on why ksh doesn't keep history for the root user:
after your system has crashed and comes up single user, you don't want to be
writing command history to the root partition and possibly compounding damage
to the file system.

Here at elsie, our /.profile file contains these line:

	ENV=/.kshrc
	export ENV

and our /.kshrc file contains these lines:

	if [ -z "$HISTFILE" ]
	then
		echo "If you want to keep command history, type"
		echo "	doh"
		echo "when it's safe to write to the root disk"
		alias doh='HISTFILE=/.history; export HISTFILE; exec /etc/ksh'
	fi
-- 
		Grocery swaps ends for Chinese native.  (5)
	ado@ncifcrf.gov			ADO is a trademark of Ampex.

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (06/10/88)

In article <8091@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes:
| Okay gang. . .the REAL scoop on why ksh doesn't keep history for the root user:
| after your system has crashed and comes up single user, you don't want to be
| writing command history to the root partition and possibly compounding damage
| to the file system.

Good point. I have my system set for login root to use sh and kr (ksh
root) to use ksh. The only time I run as root is when I'm in maint mode.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me