GNU bug report logs -
#34126
grep v. 3.1 – unexpected error message "grep: i.: No such file or directory"
Previous Next
Reported by: Ricky Tigg <ricky.tigg <at> gmail.com>
Date: Fri, 18 Jan 2019 20:28:01 UTC
Severity: normal
Tags: notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
Message #7 received at control <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tag 34126 notabug
thanks
On 1/18/19 2:27 PM, Ricky Tigg wrote:
> OS: *Fedora*; Component: grep.x86_64 3.1-8.fc29
>
> Commands executed:
>
> $ dnf list|grep -Ei langpack | grep fi.
> glibc-langpack-fi.x86_64 2.28-26.fc29 @updates
> langpacks-fi.noarch 1.0-13.fc29 @System
> (...)
>
> $ dnf list|grep -Ei langpack | grep fi. | grep "-fi."
> grep: i.: No such file or directory
>
> Using grep twice in the same command, the command's last grep is expected
> to produce targets, not an STDERR. Probably an issue.
Not an issue in grep, but in your attempt to use a pattern beginning
with - in a way that grep cannot distinguish from options. That is, you
asked grep to use the -f option, which takes an argument, so it used
"i." as the argument for -f, and failed because there is no file named
'i.' in your current directory. (That's true whether you write -fi. or
"-fi.", because the shell strips quoting before grep sees its argv[]).
You want to use either of these formulations instead:
grep -e -fi.
grep -- -fi.
where the "-e" option says to treat the next argv[] entry as a pattern,
even if it otherwise would look like an option, and then continue
finding further options; while the "--" argument says that no more
options are present, and that all further command line arguments are
treated according to their traditional positional usage). The
difference becomes apparent in constructs like:
grep -e -fi. -i # greps stdin case-insensitively for "-fi."
grep -- -fi. -i # greps file ./-i case-sensitively for "-fi."
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 6 years and 177 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.