GNU bug report logs - #30451
I found problem not solved to my grep

Previous Next

Package: grep;

Reported by: Budi <budikusasi <at> gmail.com>

Date: Wed, 14 Feb 2018 02:47:01 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Budi <budikusasi <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: I found problem not solved to my grep
Date: Wed, 14 Feb 2018 08:59:47 +0700
[Message part 1 (text/plain, inline)]
 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.
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 195 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.