set global rm command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers set global rm command
# 1  
Old 09-02-2011
Question set global rm command

Hi,

My team does not have root access however many a times my members logon to the unix server and fire the rm command mistakenly on wrong folder and later realise that they have made a mess.

The rm -i option prompts for a confirmation before actually deleting the files/folders.

I want to force the -i option to all my team members when they fire the rm command inorder to address the concern.

Can you please let me know how can that be addressed?
# 2  
Old 09-02-2011
Hi,
this is usually done by an alias which can be defined in the global profile (/etc/profile for Bourne shell and its descendants like bash, ksh,...).
# 3  
Old 09-02-2011
Question

Top of my head ... i am a dummy.. can you let me know how-to ?
# 4  
Old 09-02-2011
Code:
alias rm='rm -i'

Add it to Your /etc/profile
This User Gave Thanks to sulti For This Post:
# 5  
Old 09-02-2011
Question

Code:
ls -ltr /etc/profile
-rw-r--r--   1 root     sys          965 Jul 13  2007 /etc/profile

whereas I am

id
uid=870(wlsadmin) gid=641(wlsgrp)

How can I get this done?
# 6  
Old 09-02-2011
If you don't have root access, you can't, but have to ask the SA to implement it.

Maybe in this adapted form:
Code:
[ $( id -g ) -eq 641 ] && alias rm="rm -i"

That way it would only apply to your group, assuming all your team members are in the same primary group.
This User Gave Thanks to pludi For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Global and non-global zone resource sharing - tricky

hi all, Just a simple question but i cant get the answers in the book - In my globalzone , assuming i have 4 cpus (psrinfo -pv = 0-3), if i set dedicated-cpu (ncpus=2) for my local zone Is my globalzone left with 2 cpus or still 4 cpus ? Does localzone "resource reservation.e.g. cpu in... (6 Replies)
Discussion started by: javanoob
6 Replies

2. Shell Programming and Scripting

Unable to set Global variable outside while loop

Below is my code: count=0 if ... ... else ... find * -prune -type d | sort -r -n | while read d; do count=1 if ; then echo "Count1:$count" ... ... break 2; fi ... done ... fi echo "Count2:$count" (9 Replies)
Discussion started by: mohtashims
9 Replies

3. UNIX for Dummies Questions & Answers

Global replace command help

Hello - I am trying to use a global replace command but its not working. Here is the cmd I am using in vi: :%s/OLD/NEW/g However, in my "NEW" I already have a "/" which is not making the replace work: :%s/mytestscript.com:33232/mytestscript:70245/test.com/g the... (2 Replies)
Discussion started by: DallasT
2 Replies

4. Solaris

How to set a global alias in UNIX Solaris?

Defined a user alias in unix. Not able to use that alias in a ksh scritp. I dont want to change/source in the script to set the value. Need to set the user alias as a gloabal alias to use it in a new ksh shell window. Can you please help on this? (3 Replies)
Discussion started by: rbalaj16
3 Replies

5. UNIX for Dummies Questions & Answers

Vi global replace command

I am wondering what way, I can remove a certain text with nothing. for example: MyVariable=Y7UHNI to only: Y7UHNI removing 'MyVariable=' globally? thanks (1 Reply)
Discussion started by: DallasT
1 Replies

6. HP-UX

What is the use of command set -- and set - variable?

Hi, I am using hp unix i want to know the use of the following commands set -- set - variable thanks (4 Replies)
Discussion started by: gomathi
4 Replies

7. UNIX for Dummies Questions & Answers

Is there any global command in UNIX?

Hi, I heard about some global commands for information gathering in UNIX systems. some commands which will execute on a UNIX system in a local network and other systems will reply to these command with some information about themselves. for example, from one of those UNIX machines (in a... (15 Replies)
Discussion started by: siavash
15 Replies

8. Solaris

How to access ENV variables of non global zones in global zone???

Hi Guys, My requirement is I have file called /opt/orahome/.profile in non global zone. PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:. export PATH PS1="\${ORACLE_SID}:`hostname`:\$PWD$ " export PS1 EDITOR=vi export EDITOR ENV=/opt/orahome/.kshrc export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies

9. Shell Programming and Scripting

global variable not being set

In ksh I thought a global variable was any variable in a script or function that did not have the typeset command. I have a global in my calling script which I increment in a function, but the value does not change in the calling script. Here is the code: function f_open_log { typeset -r... (5 Replies)
Discussion started by: robotball
5 Replies
Login or Register to Ask a Question