General discussion

Locked

UNIX ENV settings

By nhennecke ·
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?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

UNIX ENV settings

by Stillatit In reply to UNIX ENV settings

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<esc>
:wq
chmod 711 /bin/rm
chown bin /bin/rm
chgrp bin /bin/rm

(In the line starting i/, <esc> 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.

Collapse -

UNIX ENV settings

by nhennecke In reply to UNIX ENV settings

Poster rated this answer

Collapse -

UNIX ENV settings

by nhennecke In reply to UNIX ENV settings

This question was closed by the author

Back to Linux Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums