Hello,

On Tue, Sep 06, 2005 at 12:16:31PM -0700, Paul Eggert wrote:
> Alexandre Duret-Lutz <[EMAIL PROTECTED]> writes:
> > Does Stepan's patch for quoting $@ before eval look right to you?
> 
> No, because echo mishandles some path names.  [...]

and what about this:

   d=`sed "s,','\\\\\\\\'',g;s,/,' ',g;s,^,',;s,\\\$,'," <ACEOF
$dstdir
ACEOF
   `

of course, it strips trailing whitespace.
Do you see any other problem?

The main reason of this question is that I'm curious.

But if you cannot see any problem, we could have an ultra-portable version:

oIFS=$IFS
case $posix_glob,$dstdir in
  true,*) oIFS=$IFS; IFS=/; set -f; set x $dstdir; shift; set +f; IFS=$oIFS;;
  *[\*\?\[]* | *\]*)
    d=`sed "s,','\\\\\\\\'',g;s,/,' ',g;s,^,',;s,$,'," <EOF
$dstdir
EOF
    `
    eval set "$d"
    ;;
  *) oIFS=$IFS; IFS=/; set x $dstdir; shift; IFS=$oIFS;;
esac

And something similar for the m4sh macro we discussed on the autoconf-patches
list.

Do you think it would be worth it?

Stepan Kasal


Reply via email to