grep pattern interpretted differently in 2 different systems with same grep version
- by Lance Woodson
We manufacture a linux appliance for data centers, and all are running fedora installed from the same kickstart process. There are different hardware versions, some with IDE hard drives and some SCSI, so the filesystems may be at /dev/sdaN or /dev/hdaN.
We have a web interface into these appliances that show disk usage, which is generated using "df | grep /dev/*da". This generally works for both hardware versions, giving an output like follows:
/dev/sda2 5952284 3507816 2137228 63% /
/dev/sda5 67670876 9128796 55049152 15% /data
/dev/sda1 101086 11976 83891 13% /boot
However, for one machine, we get the following result from that command:
Binary file /dev/sda matches
It seems that its grepping files matching /dev/*da for an unknown pattern for some reason, only on this box that is seemingly identical in grep version, packages, kernel, and hardware. I switched the grep pattern to be "/dev/.da" and everything works as expected on this troublesome box, but I hate not knowing why this is happening. Anyone have any ideas? Or perhaps some other tests to try?