On Wed, Jul 28, 2004 at 11:22:09AM -0700, Paul Eggert wrote: > Patrick Welche <prlw1@xxxxxxxxxxxxxx> writes: > > > -elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then > > +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then > > set -o posix > > +elif test -n "${KSH_VERSION+set}" && (set +o posix) >/dev/null 2>&1; then > > + set +o posix > > You need "set +o posix" for pdksh? Doesn't that disable POSIX compatibility? yes ?! > Hmm, why would this fix things? Autoconf uses what is supposed to be > a subset of plain POSIX; we don't want to encourage shells to be > incompatible with POSIX. Well, here is ====================== bar ======================= set -o posix Xsed='sed -e s/^X//' no_glob_subst='s/\*/\\\*/g' output_cmd="hello" echo "output_cmd: ($output_cmd)" output_one="`echo \"X$output_cmd\" | $Xsed -e \"$no_glob_subst\"`" echo "output_one: ($output_cmd)" output_two=`echo "X$output_cmd" | $Xsed -e "$no_glob_subst"` echo "output_two: ($output_cmd)" output_tri=$(echo "X$output_cmd" | $Xsed -e "$no_glob_subst") echo "output_tri: ($output_cmd)" =================================================== % ksh bar output_cmd: (hello) sed: 1: ""s/\*/\\\*/g"": invalid command code " output_one: (hello) output_two: (hello) output_tri: (hello) However, if I change that first line to set +o posix, % ksh bar output_cmd: (hello) output_one: (hello) output_two: (hello) output_tri: (hello) @(#)PD KSH v5.2.14 99/07/13.2 which is the same output as with sh, and no seting of posix. Quoting from ksh(1): Note: see POSIX Mode below for a special rule regarding sequences of the form "...`...\"...`..". ... POSIX Mode The shell is intended to be POSIX compliant, however, in some cases, POSIX behaviour is contrary either to the original Korn shell behaviour or to user convenience. How the shell behaves in these cases is deter- mined by the state of the posix option (set -o posix) -- if it is on, the POSIX behaviour is followed, otherwise it is not. The posix option is set automatically when the shell starts up if the environment con- tains the POSIXLY_CORRECT parameter. (The shell can also be compiled so that it is in POSIX mode by default, however this is usually not desirable). The following is a list of things that are affected by the state of the posix option: o \" inside double quoted `..` command substitutions: in posix mode, the \" is interpreted when the command is interpreted; in non-posix mode, the backslash is stripped before the command substitution is interpreted. For example, echo "`echo \"hi\"`" produces `"hi"' in posix mode, `hi' in non-posix mode. To avoid problems, use the $(...) form of command substitution. Cheers, Patrick _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf