On 03/31/2010 07:05 AM, Adil Mujeeb wrote:
> Hello team,
> 
> I have tried following snippet in a bash script:
> 
> -bash-3.1$userid=`expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" :
> ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
> -bash-3.1$echo $userid
> ADILM
> -bash-3.1$

I cannot repeat your results with 7.6 (the version in fedora 12) or the
latest coreutils.git.

$ expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" : \
   ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"

$ expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" : \
   ".*uid=[0-9]*(\(.[0-9a-zA-Z]*\)) .*"
ADILM

Perhaps you have a locale issue at play?

> -bash-3.1$ rpm -qf /usr/bin/expr
> coreutils-5.97-12.1.el5

That's rather old.  Perhaps it might be a bug that has been fixed in the
meantime, in which case, you would want to upgrade to 8.4.

At any rate, there's nothing in the source code that introduces any case
insensitivity, and the documentation is correct, that match and : behave
identically.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to