bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ${var//\\*/} result depends on bash version


From: Stanislav Brabec
Subject: Re: ${var//\\*/} result depends on bash version
Date: Wed, 03 Nov 2004 17:38:18 +0100

Chet Ramey wrote:
> > Machine Type: x86_64-suse-linux
> > 
> > Bash Version: 3.0
> > Patch Level: 0
> > Release Status: release
> > 
> > Description:
> > Simple script behavior depends on bash version.
> > Is it bug, bugfix or feature? Is there any '*' character replacement 
> > expression, which works in both versions?
> 
> It's a bugfix.  Such fixes are documented in the CHANGES file included in
> the distribution.

I read it, but it is not clean for me, which item describes it.

But maybe it should be documented in COMPAT, because it changes results
of existing scripts.

There is an automake test for it:

# AC_BASH_PARAMETER_STAR_EXPANSION_BUG
# ------------------------------------
# Check, whether bash an expansion bug for ${var/\*/}.
# You can use ${var/@BASH_PARAMETER_STAR_ESCAPE@*/} in scripts and
# don't care about this bug.
AC_DEFUN([AC_BASH_PARAMETER_STAR_EXPANSION_BUG],[
  AC_PATH_PROG([PATH_BASH], [bash])
  AC_MSG_CHECKING([whether bash has a \${var/\\*/} expansion bug])
  # Check, whether star expansion inside parameter expansion ${var/\*/}
  # needs extra backslash.
  if test x`$PATH_BASH -c 'ac_var="a*b" ; echo "${ac_var/\*/}"'` = xab ; then
    BASH_PARAMETER_STAR_ESCAPE=\\
    AC_MSG_RESULT([no])
  else
    BASH_PARAMETER_STAR_ESCAPE=\\\\
    AC_MSG_RESULT([yes])
  fi
  AC_SUBST([BASH_PARAMETER_STAR_ESCAPE])
])

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SuSE CR, s. r. o.                             e-mail: sbrabec@suse.cz
Drahobejlova 27                               tel: +420 296 542 382
190 00 Praha 9                                fax: +420 296 542 374
Czech Republic                                http://www.suse.cz/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]