[9914] in Athena Bugs

home help back first fref pref prev next nref lref last post

Command aliasing and the 'which' command - a booby trap for the unwary

daemon@ATHENA.MIT.EDU (Jim Haynes)
Wed Sep 23 14:42:42 1992

From: haynes@cats.UCSC.EDU (Jim Haynes)
Date: Wed, 23 Sep 92 11:42:07 -0700
To: bugs@Athena.MIT.EDU


This is not strictly speaking a bug, but is worth thinking about.  It
happened at UCSC, but could as easily have happened at MIT or anywhere else.

Somewhere in the login process the rm command is aliased to 'rm -i'
A user has a .login.mine file which unaliases rm.  He did
   which rm
and was told
   rm: aliased to rm -i

so he made the mistake of believing that and did 
   rm k*

and was aghast when all his files beginning with k disappeared.

Sure, it's a user error, and sure, the man page for the which command
tells you (under BUGS, of all places) that it only accesses aliases
and paths from ~/.cshrc.  But I'll argue that it's counter-intuitive,
and if you haven't read the man page for 'which' you could be a victim.



home help back first fref pref prev next nref lref last post