forked from ungleich-public/cdist
If `regex` begins with an hyphen, `grep` treats it as an option and treats `file` as the regular expression. This leads to `grep` trying to read from the standard input and making it wait infinitely. This patch adds the missing argument breaker `--` and allows `regex` to begin with an hyphen (provided it is called correctly).
This commit is contained in:
parent
3397bcbf9b
commit
fc8dded8e9
1 changed files with 1 additions and 1 deletions
|
@ -35,7 +35,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Allow missing file - thus 2>/dev/null
|
# Allow missing file - thus 2>/dev/null
|
||||||
if grep -q $greparg "$regex" "$file" 2>/dev/null; then
|
if grep -q $greparg -- "$regex" "$file" 2>/dev/null; then
|
||||||
echo present
|
echo present
|
||||||
else
|
else
|
||||||
echo absent
|
echo absent
|
||||||
|
|
Loading…
Reference in a new issue