Discussion Locked

UNIX ENV settings

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I need to know how to set rm on interactive mode not using an alias. The system I am working on is running SCO_SV 6.2 under a borne shell and it won't accept aliases. Can anyone help?

3 replies

by stillatit

The easy answer is use the korn shell (ksh), which does have alias.

Using rm -i will work, but you have to remember it.

If you insist on making it automatic in sh, which I do NOT recommend, you can do the following (as root):
mv /bin/rm /bin/realrm
vi /bin/rm
i/bin/newrm -i $1 $2 $3 $4 $5 $6 $7 $8 $9
:wq
chmod 711 /bin/rm
chown bin /bin/rm
chgrp bin /bin/rm

(In the line starting i/, is the escape key.)
You have now created a simple script file -- effectively a TrojanHorse program, which executes when a user types rm. The program calls the real rm program (which you renamed), and passes up to 9 parameters to it. This is a limitation in the script. If you want to get fancy you can add stuff to shift parameters for huge numbers of parameters. This script will work poorly with wild cards.

Good luck.

This discussion is closed to new replies.