You are not logged in.

#1 2008-09-15 03:34:24

deltaecho
Member
From: Georgia (USA)
Registered: 2008-08-06
Posts: 193

[SOLVED] Can you wrap commands for sudo?

Is there a way to wrap commands for use with sudo, such that my below command would work:

$ sudo (pacman -Sy && pacman -Su)
bash: syntax error near unexpected token `pacman'

Note: The above is just an example of what I want to do, I would normally use 'pacman -Syu'

Last edited by deltaecho (2008-09-15 06:18:24)


Dylon

Offline

#2 2008-09-15 04:21:43

tonyisnt
Member
Registered: 2008-03-18
Posts: 158

Re: [SOLVED] Can you wrap commands for sudo?

You could simply alias it with pacman.  This is what I do, and I know I'm not alone.

In .bashrc:

alias pacman='sudo pacman'

And I also have it set to not ask for a password with pacman in my sudoers file.

Offline

#3 2008-09-15 05:06:11

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] Can you wrap commands for sudo?

sudo sh -c "pacman -Sy && pacman -Su"
sudo sh -c "command_a | command_b >file_c"

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2008-09-15 06:17:54

deltaecho
Member
From: Georgia (USA)
Registered: 2008-08-06
Posts: 193

Re: [SOLVED] Can you wrap commands for sudo?

Great - those are both good suggestions!  Thank you.


Dylon

Offline

Board footer

Powered by FluxBB