"grep" not working
Dirk Moolman
DirkM
Thu May 17 05:18:38 PDT 2007
Ok, I found the problem. David was on the right track, regarding the
binary which could be different.
I found this out another way, by printing out root's profile, and the
user's profile, and sitting and comparing the 2 profiles. I first
thought this might be related to the locale or language settings, but it
wasn't.
I then got desperate, and changed her PATH settings, and viola, it
worked. I then ran a find, to look for another file with the name grep.
Interesting enough, the which & type commands, showed the correct binary
(in /usr/bin), but the find command showed me another file, sitting in
the directory she was working in.
What I think probably happened, is that, because she has command line
access, she accidentally created a file called grep (with 0 bytes), and
from there on, she was executing her own "grep" file, which ran
successfully (there was nothing in the file to make it crash)
This kept me busy long enough - took me a whole day to figure out what
the cause of this was.
Dirk
-----Original Message-----
From: linux-users-bounces at linux-sxs.org
[mailto:linux-users-bounces at linux-sxs.org] On Behalf Of Dirk Moolman
Sent: 17 May 2007 01:24 PM
To: Linux tips and tricks
Subject: RE: "grep" not working
>From: linux-users-bounces at linux-sxs.org
[mailto:linux-users-bounces at linux->sxs.org] On Behalf Of David Bandel
>Sent: 17 May 2007 01:03 PM
>
>On 5/17/07, Dirk Moolman <DirkM at agilitytech.co.za> wrote:
>> This is something I haven't seen before. One of my developers, uses
>> grep to assist in client queries (to find files and info in unload
>> files).
>>
>> When she does a grep on certain strings, she can't find anything, but
>> when I do the same grep, logged in as root, I find data.
>>
>> What would cause this ? I will have to compare her login with
root's
>> login, but I would appreciate some suggestions / tips from the
guru's.
>>
>This is usually a permissions problem. If she doesn't have permission
>to read the file, the grep will fail. You should get an error message
>unless you have added 2>/dev/null at the end redirecting the error
>channel to the bit bucket.
>
>Also ensure that both of your grep strings are _identical_. Other
>than that, grep is grep.
Both strings are identical yes. I run the command, then su, and then
copy & paste the previous command (from the previous login), and run it
again.
>I also assume you as root and she are running the same grep binary.
>Use `which grep` to make sure.
It looks like we use the same binaries. I have seen the term "tracked
alias" before, but after Googling it, it looks like the same thing as a
normal alias.
[user]
zanettar at myhost> which grep
grep is a tracked alias for /usr/bin/grep
zanettar at myhost> exit
[root]
root at myhost # which grep
/usr/bin/grep
Disclaimer: http://196.33.167.70/disclaimer
_______________________________________________
Linux-users mailing list ( Linux-users at linux-sxs.org )
Unsub/Password/Etc:
http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
*** OFF TOPIC conversations should get sent to general at linux-sxs.org.
This rule will be strictly enforced. ***
Need to chat further on this subject? Check out #linux-users on
irc.linux-sxs.org !
Disclaimer: http://196.33.167.70/disclaimer
More information about the Linux-users
mailing list