On 31.05.2012 15:45, AZ 9901 wrote: > 2012/5/31 Eric Blake <ebl...@redhat.com>: >> On 05/31/2012 05:18 AM, AZ 9901 wrote: >>> 2012/5/29 AZ 9901 : >>>> Hello, >>>> >>>> I am looking at the /bin/cron-config script. >>>> >>>> Line 627, we can find : >>>> elif net localgroup "${_admingroup}" | grep -Eiq "^${username}.?$"; then >>>> >>>> Why .? at the end of the regexp ? "^${username}.?$" >> >> Because 'net' outputs in DOS mode, with carriage returns at the end. > > OK, I was also thinking about this (talking about buggy output) but I > was not sure. > Strange that using grep -iq "^${username}$" works fine (well, I just > tested this on my XP).
This works because the current version of grep (2.6.3-1) doesn't treat its input as binary by default, but strips the carriage returns from the output of net localgroup. So grep -iq "^${username}$" matches, but grep --binary -iq "^${username}$" doesn't. > Do Windows tools output in DOS mode "when they want" ? No, od -c shows the \r\n endings in the output of net localgroup. --Dirk -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple