Howdy,

I came across this problem during a recent portmaster update. When
trying to strip off the * character using variable expansion in bin/sh
it doesn't work. Other "special" characters do work if they are
properly escaped.

The attached mini-script clearly shows the problem:

$ sh sh-strip-problem
var before stripping: foo\*
var after stripping: foo\*

var before stripping: foo\$
var after stripping: foo\

In contrast, bash does the right thing:

bash sh-strip-problem
var before stripping: foo\*
var after stripping: foo\

var before stripping: foo\$
var after stripping: foo\

Should I go ahead and file a PR on this?


Doug

-- 

    This .signature sanitized for your protection

var='foo\*'
echo "var before stripping: $var"
var=${var%\*}
echo "var after stripping: $var"
echo ''
var='foo\$'
echo "var before stripping: $var"
var=${var%\$}
echo "var after stripping: $var"

exit 0
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

Reply via email to