From unknown Sat Aug 09 13:24:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#30451: I found problem not solved to my grep Resent-From: Budi Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Wed, 14 Feb 2018 02:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30451 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 30451@debbugs.gnu.org X-Debbugs-Original-To: bug-grep@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.151857639811638 (code B ref -1); Wed, 14 Feb 2018 02:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Feb 2018 02:46:38 +0000 Received: from localhost ([127.0.0.1]:41996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eln5h-00031e-Qv for submit@debbugs.gnu.org; Tue, 13 Feb 2018 21:46:38 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elmMa-0001zJ-2D for submit@debbugs.gnu.org; Tue, 13 Feb 2018 21:00:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elmMS-0004lg-UK for submit@debbugs.gnu.org; Tue, 13 Feb 2018 20:59:54 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elmMS-0004lM-Pb for submit@debbugs.gnu.org; Tue, 13 Feb 2018 20:59:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elmMQ-00030h-Vq for bug-grep@gnu.org; Tue, 13 Feb 2018 20:59:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elmMP-0004iw-9x for bug-grep@gnu.org; Tue, 13 Feb 2018 20:59:51 -0500 Received: from mail-yw0-x22c.google.com ([2607:f8b0:4002:c05::22c]:45613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elmMP-0004ij-29 for bug-grep@gnu.org; Tue, 13 Feb 2018 20:59:49 -0500 Received: by mail-yw0-x22c.google.com with SMTP id b16so13739521ywh.12 for ; Tue, 13 Feb 2018 17:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=fcfrh0yzGzTHnICX+nYAFGgc60VsYVubZf3nyqnhBx0=; b=D4lGszihJDBMuImS0QofkWtSfohN5NIunYrJI6fi+fDOHAr4jD+u0sqFfVRC8bxIJm mU+sMVmCm7MiGhlWPQTOcjbhR+m5m6sroLS7HjGoO4+Thny+XHx4tAe6eo4Ly3MYHeAU lq2nTI6KDtBumuJ5Jz4Kzir9xKIePDlj3hLxS9jdOfKaLyVdrydCw4B65B3vJWQ4aBB/ SAplD52HB+JK1el7ZcF0DQAnoQHXWbnyuIyetgsee1Ak5ZUm3gNo+6qX54c8vrynBvoO tLVqDuVvH21kLx0pSEd7xMzXKDF8ubhuUHrBwZ+TAEulHN8H3uqPDfuZyyLt2/wV+N1d OCug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=fcfrh0yzGzTHnICX+nYAFGgc60VsYVubZf3nyqnhBx0=; b=QyZCKzO+rCwNgMULOSDibWzI9/7/W1MXIetG2cPpndSSeukQ/Z/pzKfva398rDn802 xAi5aKy6Ui6i0Op3zvgh111jLENC68KSz6tZJiccrVD6vYqsooApyzsN2LmjRXVL0BK7 8xxoURiqBY2qm+W7zPuOoHUpfgJ9PI5sY68vfKq5BZs4lcyYPguLHlh7+riX4ixdr/Lf kD4DBcXw3wgkvyEckgDbR3VjowV8nvgoK6h1GIrVJdllcW7Vyxzz6Y+D5bgKUV7UurZx I5hAclDz7ghmZGVQieqYv9dfNN2mTwbYLDBXu3QYsgKirlmCmfPUpC0wYFkTObk2Qb0R SjPA== X-Gm-Message-State: APf1xPB/jgTV+CCf5PIa8H9KEup2+VriY/tCcabLfI79gUiGHrei4ofL HqxvmzBuGFR7a6ox7V8Cl7ZmFBUzFJzxEwUQtXT+mQ== X-Google-Smtp-Source: AH8x225iKeQBAls4JZ6LGDuyyssYMjD4LoM3CEXGhMf5+emtE3sOKae/kXPWocs1csLhokEgdWJ3czvgkwK01RVqqiQ= X-Received: by 10.37.194.131 with SMTP id s125mr2118282ybf.452.1518573587904; Tue, 13 Feb 2018 17:59:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.107.5 with HTTP; Tue, 13 Feb 2018 17:59:47 -0800 (PST) From: Budi Date: Wed, 14 Feb 2018 08:59:47 +0700 Message-ID: Content-Type: multipart/alternative; boundary="94eb2c05504445be10056522774a" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Tue, 13 Feb 2018 21:46:35 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --94eb2c05504445be10056522774a Content-Type: text/plain; charset="UTF-8" I tried to customize grep: Code: g () { if [ -n "$2" ] then i= for s in $2 do i="$i --include=*.$s" done else i='--include=*.txt --include=*.ini --include=*.*sh --include=*.c* --include=*.h --include=*.js --include=*.reg' fi grep -P -e \'$1\' -r $i } or with double quote "$i" as tested and used below Code: $ g sys ini grep: --include=*.ini: No such file or directory without it, ie. "", it'll just freeze awhile as if it processes properly, if one inserts 'echo' to the last line for tracking and test: echo grep -P -e \'$1\' -r $i then reload the alias file and redo it, Code: $ g sys ini grep -P -e 'sys' -r --include=*.ini it'll echo correctly to become perfectly a valid grep command line... What's actually happened and how to fix and solve this ? Thanks so much in advance. --94eb2c05504445be10056522774a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I tried to=C2=A0 customize gre= p:

Code:
g () {
if [ -n "$2" ]
then
 i=3D
 for s in $2
 do
	i=3D"$i --include=3D*.$s"
 done
 else
	i=3D'--include=3D*.txt --include=3D*.ini --include=3D*.*sh --include=
=3D*.c* --include=3D*.h --include=3D*.js --include=3D*.reg'
fi
grep -P -e \'$1\' -r $i
}
or with double qu= ote "$i" as tested=C2=A0and used below

Code:
$ g sy=
s ini
grep:  --include=3D*.ini: No such file or directory
without it, ie. "", it'll j= ust freeze awhile as if it processes properly,
if one inserts 'echo' to= the last line for tracking and test:


echo grep -P -e \'=
;$1\' -r $i 
th= en reload the alias file and redo it,

Code:
$ g sys ini
grep -P -e 'sys' -r  --include=3D*.ini
it'll echo correctly to become perfectly a = valid grep command line...
What's actually happened and how to fix and solve this ?
Thanks so much in a= dvance.


--94eb2c05504445be10056522774a-- From unknown Sat Aug 09 13:24:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#30451: I found problem not solved to my grep Resent-From: Paul Jackson Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Wed, 14 Feb 2018 07:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30451 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 30451@debbugs.gnu.org X-Debbugs-Original-To: bug-grep@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.151859366813008 (code B ref -1); Wed, 14 Feb 2018 07:35:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Feb 2018 07:34:28 +0000 Received: from localhost ([127.0.0.1]:42116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elraG-0003Nj-7V for submit@debbugs.gnu.org; Wed, 14 Feb 2018 02:34:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elraE-0003NY-Qn for submit@debbugs.gnu.org; Wed, 14 Feb 2018 02:34:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elra8-0006xD-PG for submit@debbugs.gnu.org; Wed, 14 Feb 2018 02:34:21 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elra8-0006x1-Lm for submit@debbugs.gnu.org; Wed, 14 Feb 2018 02:34:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elra7-0004DH-Jp for bug-grep@gnu.org; Wed, 14 Feb 2018 02:34:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elra4-0006tk-EH for bug-grep@gnu.org; Wed, 14 Feb 2018 02:34:19 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:52011) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elra4-0006sx-9r for bug-grep@gnu.org; Wed, 14 Feb 2018 02:34:16 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 2AECD20E71 for ; Wed, 14 Feb 2018 02:34:15 -0500 (EST) Received: from web2 ([10.202.2.212]) by compute1.internal (MEProxy); Wed, 14 Feb 2018 02:34:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=6oi6gi lkkYJLkadOidGTzx47V/nQGa8S46IQaqLNto4=; b=RmBEz8MQ4iIG3LOSq/e2nz 2ztAhVX5YQSOh4vSc8RuiC+k+3E3AZJLNuFQuQ3LRGjHYIuabnOhEdYOiRVDAv/Y 5lhEfdS1FEmP5m59V3RwdRyiJTQ/M6v1F5iT5in6TuiSN+XHDWdf/R94Irq+bbeG ug4kMGy5K6Lw8Ecg1nIYB8JMG6iGDH5qZKbyvs13mFrEmn6ACA4hWhOP6vHLLUEr GC1/Z0KkErDUCbbgnT1egV7qeP2LO4q0A9p/5YHWy0n4Ox5q/ZxnieePTa68duPX CX9M+J11ycOaVINJLj3yY9FwB1A2wQJ93piuVvLNoxEswQlM4gP7azgyVeUhyOqQ == X-ME-Sender: Received: by mailuser.nyi.internal (Postfix, from userid 99) id E90FB621DC; Wed, 14 Feb 2018 02:34:14 -0500 (EST) Message-Id: <1518593654.1766876.1270275696.69133104@webmail.messagingengine.com> From: Paul Jackson MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-fde26eb3 References: In-Reply-To: Date: Wed, 14 Feb 2018 01:34:14 -0600 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) I believe that this is a problem with using shell quoting and spacing. The following code works better for me: ======================== g() { if [ -n "$2" ] then i= for s in $2 do if [ -n "$i" ] then i="$i --include=*.$s" else i="--include=*.$s" fi done else i='--include=*.txt --include=*.ini --include=*.*sh --include=*.c* --include=*.h --include=*.js --include=*.reg' fi grep -P -e "$1" -r $i } ======================== The two changes I made: 1) Avoid putting a space at the front of the first "--include=*.$s" argument. 2) Double quote, not escaped single quote, the "$1" parameter to grep. The parameter " --include=*.ini" was not a valid "--include" argument to grep; rather it looked like a filename to grep, as its first character was a space. The escaped single quotes around the "$1" parameter meant that you were not looking for the three character pattern "sys", but rather for the five character pattern "'sys'" (which is less likely to have appeared in your test data.) -- Paul Jackson pj@usa.net From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 31 15:58:34 2019 Received: (at control) by debbugs.gnu.org; 31 Dec 2019 20:58:34 +0000 Received: from localhost ([127.0.0.1]:35265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imOb3-0000zH-TQ for submit@debbugs.gnu.org; Tue, 31 Dec 2019 15:58:34 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imOb2-0000z4-UP for control@debbugs.gnu.org; Tue, 31 Dec 2019 15:58:33 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8444916027C for ; Tue, 31 Dec 2019 12:58:27 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 7IW-GO8uexza for ; Tue, 31 Dec 2019 12:58:27 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EC5F616027E for ; Tue, 31 Dec 2019 12:58:26 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nHZvh_bWB4YI for ; Tue, 31 Dec 2019 12:58:26 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id CDB6F16027C for ; Tue, 31 Dec 2019 12:58:26 -0800 (PST) To: control@debbugs.gnu.org From: Paul Eggert Subject: 30451 is not a bug Organization: UCLA Computer Science Department Message-ID: Date: Tue, 31 Dec 2019 12:58:26 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 30451 notabug close 30451