Hi,
I am getting different output for grep depending which directory I am in.
The following is a transcript of my session, I am using egrep but have also used grep -E. The directory names have been changed for security:
$pwd
/dir1/dir2/dir3/dir4
$echo 000000 |egrep -v [0-1][0-9][0-5][0-9][0-5][0-9]
$echo $?
1
$cd ..
$pwd
/dir1/dir2/dir3
$echo 000000 |egrep -v [0-1][0-9][0-5][0-9][0-5][0-9]
000000
$echo $?
0
$cd ..
$pwd
/dir1/dir2
$echo 000000 |egrep -v [0-1][0-9][0-5][0-9][0-5][0-9]
$echo $?
1
$
It appears the output from egrep when run in directory /dir1/dir2/dir3 is the opposite of what I would expect
/dir1/dir2/dir3 and /dir1/dir2/dir3/dir4 are on the same volume.
I have checked and there is only one instance of egrep on the whole server.
The permissions of the directories are as follows
drwxr-xr-x /dir1/dir2
drwxrwxrwx /dir1/dir2/dir3
drwxr-xr-x /dir1/dir2/dir3/dir4
We can't work out why this is happening. Can anyone help?
Many thanks
Helen