bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep . /; echo $?


From: Dan Jacobson
Subject: grep . /; echo $?
Date: Thu, 20 Oct 2005 11:58:50 +0800

In grep (GNU grep) 2.5.1, we see
       -d ACTION, --directories=ACTION If an input file is a
              directory, use ACTION to process it. By default, ACTION
              is read, which means that directories are read just as
              if they were ordinary files.

Indeed, the man page should mention that this is the case even with no -d!
Or better yet, exit with a message and a different error value, and
document it.

$ grep . /;echo $?
1
$ strace grep . /
...open("/", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
read(3, 0x8071000, 32768) = -1 EISDIR (Is a directory)...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]