From root@bang.freebsd.dk  Sun Mar  6 17:53:24 2005
Return-Path: <root@bang.freebsd.dk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A6D6216A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Mar 2005 17:53:24 +0000 (GMT)
Received: from bang.freebsd.dk (f170.freebsd.dk [212.242.86.170])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CE2CA43D39
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Mar 2005 17:53:23 +0000 (GMT)
	(envelope-from root@bang.freebsd.dk)
Received: from bang.freebsd.dk (localhost.freebsd.dk [127.0.0.1])
	by bang.freebsd.dk (8.13.3/8.13.1) with ESMTP id j26HrKWY046280
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 6 Mar 2005 18:53:20 +0100 (CET)
	(envelope-from root@bang.freebsd.dk)
Received: (from root@localhost)
	by bang.freebsd.dk (8.13.3/8.13.1/Submit) id j26HrJlP046279;
	Sun, 6 Mar 2005 18:53:19 +0100 (CET)
	(envelope-from root)
Message-Id: <200503061753.j26HrJlP046279@bang.freebsd.dk>
Date: Sun, 6 Mar 2005 18:53:19 +0100 (CET)
From: Charlie & <root@bang.freebsd.dk>
Reply-To: Charlie & <root@bang.freebsd.dk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: grep --exclude does not check directories ?
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         78504
>Category:       bin
>Synopsis:       grep --exclude does not check directories ?
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 06 18:00:07 GMT 2005
>Closed-Date:    Fri Apr 08 14:41:37 GMT 2005
>Last-Modified:  Fri Apr 08 14:41:37 GMT 2005
>Originator:     Charlie &
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD bang.freebsd.dk 6.0-CURRENT FreeBSD 6.0-CURRENT #2: Tue Feb 15 14:21:39 CET 2005 root@bang.freebsd.dk:/bang/p4/phk/phk_bufwork/sys/i386/compile/BANG i386

	-current.

>Description:

	# cat grep.sh
	#!/bin/sh

	mkdir __
	cd __
	mkdir aaa
	echo foo > a1
	echo foo > aaa/a1

	set -x
	grep -r --exclude=aaa foo .
	# sh -x grep.sh
	+ grep -r --exclude=aaa foo .
	./aaa/a1:foo
	./a1:foo

	It doesn't seem possible to exclude directories when using
	the -r(ecursive) option.

	
>How-To-Repeat:
	see above.
>Fix:



>Release-Note:
>Audit-Trail:

From: Chris Hodgins <chodgins@cis.strath.ac.uk>
To: Charlie & <root@bang.freebsd.dk>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/78504: grep --exclude does not check directories ?
Date: Mon, 07 Mar 2005 17:38:47 +0000

 Charlie & wrote:
 >>Number:         78504
 >>Category:       bin
 >>Synopsis:       grep --exclude does not check directories ?
 >>Confidential:   no
 >>Severity:       non-critical
 >>Priority:       medium
 >>Responsible:    freebsd-bugs
 >>State:          open
 >>Quarter:        
 >>Keywords:       
 >>Date-Required:
 >>Class:          sw-bug
 >>Submitter-Id:   current-users
 >>Arrival-Date:   Sun Mar 06 18:00:07 GMT 2005
 >>Closed-Date:
 >>Last-Modified:
 >>Originator:     Charlie &
 >>Release:        FreeBSD 6.0-CURRENT i386
 >>Organization:
 >>Environment:
 > 
 > System: FreeBSD bang.freebsd.dk 6.0-CURRENT FreeBSD 6.0-CURRENT #2: Tue Feb 15 14:21:39 CET 2005 root@bang.freebsd.dk:/bang/p4/phk/phk_bufwork/sys/i386/compile/BANG i386
 > 
 > 	-current.
 > 
 > 
 >>Description:
 > 
 > 
 > 	# cat grep.sh
 > 	#!/bin/sh
 > 
 > 	mkdir __
 > 	cd __
 > 	mkdir aaa
 > 	echo foo > a1
 > 	echo foo > aaa/a1
 > 
 > 	set -x
 > 	grep -r --exclude=aaa foo .
 > 	# sh -x grep.sh
 > 	+ grep -r --exclude=aaa foo .
 > 	./aaa/a1:foo
 > 	./a1:foo
 > 
 > 	It doesn't seem possible to exclude directories when using
 > 	the -r(ecursive) option.
 > 
 
 The man page states that the exclude flag is for skipping files and not 
 directories.
 
           --exclude=PATTERN
                Recurse in directories skip file matching PATTERN.
 
 You can do what you want with the find command.
 
 find . \( -type d -name "aaa" -prune \) -o -print
 
 Chris
 
 > 	
 > 
 >>How-To-Repeat:
 > 
 > 	see above.
 > 
 >>Fix:
 > 
 > 
 > 
 > 
 >>Release-Note:
 >>Audit-Trail:
 >>Unformatted:
 > 
 > _______________________________________________
 > freebsd-bugs@freebsd.org mailing list
 > http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 > To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 > 
 
State-Changed-From-To: open->closed 
State-Changed-By: vs 
State-Changed-When: Fri Apr 8 14:41:04 GMT 2005 
State-Changed-Why:  
Feature works as advertised: It's for skipping files, not directories as 
Chris correctly points out. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=78504 
>Unformatted:
