Can you pipe an additional command using sudo

Paul M. Lambert plambert at
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..."


On Thu, 06 Jun 2002, peterschmeichel at 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>
> For list information, options, or to unsubscribe, visit:

More information about the sudo-users mailing list