Re: sudo - protected directory

2010-04-20 Thread Alexander Hall
On 04/20/10 00:37, Frank Bax wrote:
 The first example in 'man sudo' shows how to list files in a protected
 directory:
 sudo ls /usr/local/protected
 
 I am not sure how I would search the contents of files found in such a
 directory, for example:
 $ sudo ls -l /var/spool/mqueue/
 total 8
 -rw---  1 root  wheel  2031 Apr 17 02:54 dfo3H6qkaT024430
 -rw---  1 root  wheel   936 Apr 19 18:22 qfo3H6qkaT024430
 $ sudo grep . /var/spool/mqueue/
 
 How do I get some output from this grep command?
 

Hmmm, maybe from using it properly? ;-)

For these cases I either use -r (as Nicholas already pointed out), or,
if you want or need to use a glob for finding the files, wrap it up like:

$ sudo sh -c 'grep . /var/spool/mqueue/*'

/Alexander



sudo - protected directory

2010-04-19 Thread Frank Bax
The first example in 'man sudo' shows how to list files in a protected 
directory:

sudo ls /usr/local/protected

I am not sure how I would search the contents of files found in such a 
directory, for example:

$ sudo ls -l /var/spool/mqueue/
total 8
-rw---  1 root  wheel  2031 Apr 17 02:54 dfo3H6qkaT024430
-rw---  1 root  wheel   936 Apr 19 18:22 qfo3H6qkaT024430
$ sudo grep . /var/spool/mqueue/

How do I get some output from this grep command?



Re: sudo - protected directory

2010-04-19 Thread Nicholas Marriott
Use grep -r?

On Mon, Apr 19, 2010 at 06:37:23PM -0400, Frank Bax wrote:
 The first example in 'man sudo' shows how to list files in a
 protected directory:
   sudo ls /usr/local/protected
 
 I am not sure how I would search the contents of files found in such
 a directory, for example:
   $ sudo ls -l /var/spool/mqueue/
   total 8
   -rw---  1 root  wheel  2031 Apr 17 02:54 dfo3H6qkaT024430
   -rw---  1 root  wheel   936 Apr 19 18:22 qfo3H6qkaT024430
   $ sudo grep . /var/spool/mqueue/
 
 How do I get some output from this grep command?