bug-grep
[Top][All Lists]
Advanced

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

Bug - difference in action between entering in Bash and in a script


From: John Bowling
Subject: Bug - difference in action between entering in Bash and in a script
Date: Wed, 07 Mar 2007 20:04:49 -0700
User-agent: Thunderbird 1.5.0.9 (X11/20060911)

When I enter:

cat abc | grep -B 1 -i xyz > xyz
    or
cat abc | grep --before-context=1 -i xyz > xyz

and xyz is found, the prior line will be output when entered via bash
but not when done within a script.  It will sometimes output a prior
line, but rarely the immediately prior line, which it always does when
entered by Konsole.
The script file begins with "#!/bin/bash"

Results are the same when:
    the output is redirected to a file or defaults to the terminal.
    -i prior to search string is used or not.
    assorted values for xyz

grep --help shows
  -B, --before-context=NUM  print NUM lines of leading context

This is in openSUSE 10.2 - 64 bit. and was also there with 10.0 - 32 bit
and 10.1 - 32 bit, accessing as a normal user via Konsole.

Thanks, John




reply via email to

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