You are not logged in.

#1 2010-03-28 07:52:17

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

[SOLVED] - sudo - alias problem

I use vim for most of my work but its a general habit to just type vi in the shell and make vim open.
I have mentioned

alias vi="vim"

in the ~/.bashrc file
but I also want this to be done with

sudo vi

Hoe can this be achieved?

Last edited by theta (2010-03-28 08:19:46)

Offline

#2 2010-03-28 08:04:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] - sudo - alias problem

You could use:

alias svi="sudo vim"

or some variant thereof...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2010-03-28 08:06:16

chpln
Member
From: Australia
Registered: 2009-09-17
Posts: 361

Re: [SOLVED] - sudo - alias problem

alias sudo="sudo "
Bash Info Manual wrote:

If the last character of the alias value is a space or tab character, then the next command word following the alias is also checked for alias expansion.

Last edited by chpln (2010-03-28 08:06:50)

Offline

#4 2010-03-28 08:07:01

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: [SOLVED] - sudo - alias problem

I believe if I understand your question right...adding this to your ~/.bashrc will do that.

alias sudo='sudo '

Note the space at the end.

Edit: Bah! You have won this time, chpln, but next time I will defeat you!

Last edited by Kiwi (2010-03-28 08:09:02)

Offline

#5 2010-03-28 08:19:29

theta
Member
From: India
Registered: 2010-01-16
Posts: 174

Re: [SOLVED] - sudo - alias problem

Thanks, that solved my problem

Offline

Board footer

Powered by FluxBB