Can you pipe an additional command using sudo

Paul M. Lambert plambert at plambert.net
Thu Jun 6 17:14:14 EDT 2002


sudo runs whatever arguments it is given.  Your shell is seeing the |
and splitting the command there.

There are two ways around this.  One is to do:

sudo -v

followed by

sudo find /usr/local -type f -exec ls -ld {} \; | sudo awk '{sum+=$5} END {print sum}'

or you could do:

sudo sh -c "...your long command here with pipe included..."

--plambert

On Thu, 06 Jun 2002, peterschmeichel at discoverfinancial.com wrote:

> I am trying to get the following command to run. Any suggestions ?
> 
> sudo find /usr/local -type f -exec ls -ld {} \; | awk '{sum+=$5} END {print
> sum}'
> 
> I can get the command to run up to the point where the "|" is.
> 
> Thanks,
> 
> Pete
> 
> ____________________________________________________________ 
> sudo-users mailing list <sudo-users at sudo.ws>
> For list information, options, or to unsubscribe, visit:
> http://www.sudo.ws/mailman/listinfo/sudo-users



More information about the sudo-users mailing list