Description of problem: On Fedora 17 and earlier, this would set userdir equal to something like /home/greearb/ when pwd was /home/greearb/git On Fedora 19, userdir is empty. PWD=$(pwd) userdir=$(expr match "$PWD" '\(/home/[0-Z]*/\).*') Work-around seems to be: [[ $PWD =~ (/home/[0-Z]*/).* ]] && userdir=${BASH_REMATCH[1]} Not sure if this is a bug in expr or my bash script, but since it used to work and now doesn't, it might be a regression. Version-Release number of selected component (if applicable): coreutils 8.21-11 How reproducible: Always. Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Thanks for report, I'm able to reproduce it with coreutils-8.21, not able with coreutils-8.17 and older (so "only" F19+ systems affected). As the expr code didn't change meanwhile, I assume gnulib regexp module has some related changes. I'll try to investigate it more, unfortunately even the "debug" mode in expr was not really helpful so far.
In Fedora 17 and earlier was parsing of regexp case-insensitive, so you couldn't match only what you want. You need: userdir=$(expr match "$PWD" '\(/home/[0-9a-zA-Z]*/\).*') This behaviour is expected (discussed with upstream). It's not bug.
Yes [0-Z] is a very unusual range that would not have worked in C locales anyway for example. The behavior here is implementation defined according to POSIX. There has been movement lately to implement "Rational Ranges" in GNU tools. Some links: http://sourceware.org/ml/libc-alpha/2012-12/msg00456.html http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=6410c7a6 http://lists.gnu.org/archive/html/bug-grep/2011-12/msg00003.html