1834144 Members
2099 Online
110064 Solutions
New Discussion

Re: Interactive rm

 
SOLVED
Go to solution
Sanjiv Sharma_1
Honored Contributor

Interactive rm

Hi,

I want to make the rm command to run in the interactive mode by default. What needs to be done?


# rm (filename)
should work like
# rm -i (filename) but I need to type only

# rm (filename)

Thanks,
Everything is possible
10 REPLIES 10
Pete Ellis
Trusted Contributor
Solution

Re: Interactive rm

Set up an alias in your .profile

alias rm='rm -i'
Ramkumar Devanathan
Honored Contributor

Re: Interactive rm

hi,

alias rm="rm -i"

Add the above to your ~/.login or ~/.profile file.

- ramd.
HPE Software Rocks!
James R. Ferguson
Acclaimed Contributor

Re: Interactive rm

Hi:

Simply create an alias in your $HOME/.profile:

# alias rm='rm -i'
# alias rmdir='rmdir -i'

Regards!

...JRF...
T G Manikandan
Honored Contributor

Re: Interactive rm

sh or ksh
alias rm='rm -i'

csh
alias rm rm -i
John Meissner
Esteemed Contributor

Re: Interactive rm

insert an alias into your .profile or into /etc/profile

alias rm="rm -i"
alias rmdir="rmdir -i"
All paths lead to destiny
Radhakrishnan Venkatara
Trusted Contributor

Re: Interactive rm

hi,

u can use alias which is the inbuilt shell command. place it in any in your .profile or in /etc/profile.

alias rm="rm -i"


alias name can be anything . so be careful in doing it.


radhakrishnan
Negative thinking is a highest form of Intelligence
Zafar A. Mohammed_1
Trusted Contributor

Re: Interactive rm

Just add one line in your .profile file:
alias rm='rm -i'

Zafar


Paddy_1
Valued Contributor

Re: Interactive rm

the solution is already given in the above messages.i just want to add a different facet.

create a file called -i in the directory you wish to have .In shell "-" has precedence over letters and hence rm * command will be interpreted as rm -i * .
The sufficiency of my merit is to know that my merit is NOT sufficient
John Meissner
Esteemed Contributor

Re: Interactive rm

Paddy,
That quite interseting ... I never thought about that. This is a clever way to pass the -i option to anyone on the system regardless of alias's. especially if you want to protect a specific directory.

Clever
All paths lead to destiny
Paul Sperry
Honored Contributor

Re: Interactive rm

Paddy,

Very cleaver, just what I was looking for