#! /bin/sh# sh.test - check that we haven't forgotten a `test' command# Test script header.need_prefix=noif test -z "$srcdir"; thensrcdir=`echo "$0" | sed 's%/[^/]*$%%'`test "$srcdir" = "$0" && srcdir=.test "${VERBOSE+set}" != "set" && VERBOSE=yesfi. $srcdir/defs || exit 1# Check all the "portable" shell scripts.status=0scripts="$srcdir/../ltmain.sh"# Check for bad binary operators.if $EGREP -n -e "if[ ]+[\"']?\\$.*(=|-[lg][te]|-eq|-ne)" $scripts; thenecho "use \`if test \$something =' instead of \`if \$something ='"status=1fi# Check for bad unary operators.if $EGREP -n -e 'if[ ]+-' $scripts; thenecho "use \`if test -X' instead of \`if -X'"status=1fi# Check for using `[' instead of `test'.if $EGREP -n -e 'if[ ]+\[' $scripts; thenecho "use \`if test' instead of \`if ['"status=1fiif $EGREP -n -e 'test[ ]+(![ ])?(-.[ ]+)?"?[.,_x]' $scripts; thenecho "use \`test \"X...\"' instead of \`test \"x...\"'"status=1fi# Check for using test X... instead of test "X...if $EGREP -n -e 'test[ ]+(![ ])?(-.[ ]+)?X' $scripts; thenecho "use \`test \"X...\"' instead of \`test X'"status=1fi# Check for using test $... instead of test "$...if $EGREP -n -e 'test[ ]+(![ ])?(-.[ ]+)?X?\$' $scripts; thenecho "use \`test \"\$...\"' instead of \`test \$'"status=1fi# Never use test -e.if $EGREP -n -e 'test[ ]+(![ ])?-e' $scripts; thenecho "use \`test -f' instead of \`test -e'"status=1fi# Check for problems with variable assignments.if $EGREP -n -e '[^ ]=[^ ].*(break|continue)' $scripts; thenecho "assignments on the same line as a \`break' or \`continue' may have no effect"status=1fi# Check for uses of Xsed without corresponding echo "Xif $EGREP -n -e '\$Xsed' $scripts | $EGREP -v -n -e '\$echo \\*"X'; thenecho "occurrences of \`\$Xsed\' without \`echo \"X\' on the same line"status=1fi# Check for quotes within backquotes within quotes "`"bar"`"if $EGREP -n -e '"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"' $scripts | \$EGREP -v "### testsuite: skip nested quoting test$"; thenecho "nested quotes are dangerous"status=1fifor s in "$srcdir/../libtool.m4"doif $SED -n '/case \$cc_basename in/,/esac/ {/^[ ]*[a-zA-Z][a-zA-Z0-9+]*[^*][ ]*)/p};' $s | $EGREP .; thenecho "\$cc_basename matches should include a trailing \`*' in $s."status=$EXIT_FAILUREfidoneexit $status