[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interaction of -i with square brackets
From: |
Geoff Kuenning |
Subject: |
Interaction of -i with square brackets |
Date: |
16 Nov 2005 01:21:35 -0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
I've stumbled across a what seems to be very strange and unpleasant
interaction between the -i switch, backslashed square brackets, and
character classes.
What's _really_ odd is that it depends on whether I'm running as root.
I've racked my brains (as shown below) trying to find differences
between my account and root, to no avail. The problem is reproducible
on two different machines that have very similar configurations.
I'm convinced that it's a bug in my configuration, not grep, but I
sure can't figure out where else to look.
The following shell session illustrates the problem:
mallet:501> grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mallet:502> echo '[Tuesday' | grep '\[[T]'
[Tuesday
mallet:503> echo '[Tuesday' | grep -i '\[[T]'
[Tuesday
mallet:504> %%
su
bash-3.00# echo '[Tuesday' | grep '\[[T]'
[Tuesday
bash-3.00# echo '[Tuesday' | grep -i '\[[T]'
bash-3.00# grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bash-3.00# typeset -f grep
bash-3.00# alias grep
bash: alias: grep: not found
bash-3.00# z
[1]+ Stopped su
mallet:505> typeset -f grep
mallet:506> alias grep
-bash: alias: grep: not found
mallet:507> which grep
/usr/bin/grep
mallet:508> %%
su
bash-3.00# which grep
/bin/grep
bash-3.00# ls -l /usr/bin/grep /bin/grep
-rwxr-xr-x 1 root root 128672 Mar 19 2005 /bin/grep
lrwxrwxrwx 1 root root 9 Jul 17 14:23 /usr/bin/grep -> /bin/grep
bash-3.00# echo '[Tuesday' | /bin/grep -i '\[[T]'
bash-3.00# echo '[Tuesday' | /usr/bin/grep -i '\[[T]'
bash-3.00# echo '[Tuesday' | PATH=/usr/bin grep -i '\[[T]'
bash-3.00# echo $LD_LIBRARY_PATH
bash-3.00# z
[1]+ Stopped su
mallet:509> echo $LD_LIBRARY_PATH
/usr/local/lib:/usr/lib:/lib:/usr/X11R6/lib:/home/geoff/lib/i86pc
mallet:510> %%
su
bash-3.00# echo '[Tuesday' |
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:/usr/X11R6/lib:/home/geoff/lib/i86pc
grep -i '\[[T]'
--
Geoff Kuenning address@hidden http://www.cs.hmc.edu/~geoff/
Microsoft's motto: "We Have Worked Out All The Buggs"
-- Dave Barry
- Interaction of -i with square brackets,
Geoff Kuenning <=