[Ffmpeg-devel] bash substitutions

Rich Felker dalias
Sun Dec 18 11:47:19 CET 2005


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.
> >
> And dash on debian.
> 
> >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%.*}
However, is this portable, or is it yet another bashism??

Rich





More information about the ffmpeg-devel mailing list