[Ffmpeg-devel] bash substitutions

Diego Biurrun diego
Tue Jan 3 16:11:51 CET 2006


On Sun, Dec 18, 2005 at 05:47:19AM -0500, Rich Felker wrote:
> On Sun, Dec 18, 2005 at 10:43:22AM +0100, matthieu castet wrote:
> > Jacob Meuser wrote:
> > >revision 1.217 of configure added some shell substitutions.
> > >these apparently only work with bash, which is _not_ the /bin/sh
> > >on all systems.
> > >
> > >specifically:
> > >
> > >  echo "SPPMAJOR=${lavc_version/.*/}" >> config.mak
> > >  echo "LAVCMAJOR=${lavc_version/.*/}" >> config.mak
> > >  echo "LAVFMAJOR=${lavf_version/.*/}" >> config.mak
> > >  echo "LAVUMAJOR=${lavu_version/.*/}" >> config.mak
> > >
> > >this not work with pdksh, which is the /bin/sh on OpenBSD.
> > >I doubt it works with ash, which is the /bin/sh on NetBSD.
> > >
> > >I suggest the following patch.
> > 
> > you could use on sh :
> > ${parameter%word}
> > ${parameter%%word}
> > ${parameter#word}
> > ${parameter##word}
> > 
> > Something like ${lavu_version%%.[^.]*} should work
> 
> Or ${lavc_version%.*}

No, you need %%.

> However, is this portable, or is it yet another bashism??

It works with dash and ash on Debian.  I bet it won't work on that thing
that Sun calls Unix, but nothing ever does.

I've committed the %% version for now, we use this kind of string
processing all over the place anyway.

Diego





More information about the ffmpeg-devel mailing list