Changeset 30 for trunk/test/test.sh
- Timestamp:
- Apr 27, 2006, 10:40:32 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/test.sh
r29 r30 19 19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 20 # 21 22 # ----------------------------------------------------------------------- 23 # Be Bourne compatible 24 # ----------------------------------------------------------------------- 25 26 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 27 emulate sh 28 NULLCMD=: 29 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then 30 set -o posix 31 fi 32 33 # ----------------------------------------------------------------------- 34 # Make sure we support functions (from the autoconf manual) 35 # ----------------------------------------------------------------------- 36 37 TSHELL="${TSHELL-/bin/sh}" 38 if test x"$1" = "x--re-executed" 39 then 40 shift 41 elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1 42 then 43 : 44 else 45 for cmd in sh bash ash bsh ksh zsh sh5; do 46 X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin"; 47 OLD_IFS=${IFS} 48 IFS=':'; export IFS 49 for dir in $X; do 50 shell="$dir/$cmd" 51 if (test -f "$shell" || test -f "$shell.exe") 52 then 53 if "$shell" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1 54 then 55 TSHELL="$shell"; export TSHELL 56 IFS=${OLD_IFS}; export IFS 57 exec "$shell" "$0" --re-executed ${1+"$@"} 58 fi 59 fi 60 done 61 IFS=${OLD_IFS}; export IFS 62 done 63 echo "-----------------------------------------------------------------" 64 echo "ERROR: Unable to locate a shell interpreter with function support" >&2 65 echo "-----------------------------------------------------------------" 66 { (exit 1); exit 1; } 67 fi 68 69 # ----------------------------------------------------------------------- 70 # Make sure we support 'let' (from the autoconf manual) 71 # ----------------------------------------------------------------------- 72 73 TSHELL="${TSHELL-/bin/sh}" 74 if test x"$1" = "x--re-run" 75 then 76 shift 77 elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1 78 then 79 : 80 else 81 for cmd in sh bash ash bsh ksh zsh sh5; do 82 X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin"; 83 OLD_IFS=${IFS} 84 IFS=':'; export IFS 85 for dir in $X; do 86 shell="$dir/$cmd" 87 if (test -f "$shell" || test -f "$shell.exe") 88 then 89 if "$shell" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1 90 then 91 if "$shell" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1 92 then 93 TSHELL="$shell"; export TSHELL 94 IFS=${OLD_IFS}; export IFS 95 exec "$shell" "$0" --re-run ${1+"$@"} 96 fi 97 fi 98 fi 99 done 100 IFS=${OLD_IFS}; export IFS 101 done 102 echo "-----------------------------------------------------------------" 103 echo "ERROR: Unable to locate a shell interpreter with support for 'let'" >&2 104 echo "-----------------------------------------------------------------" 105 { (exit 1); exit 1; } 106 fi 107 108 109 umask 0022 21 110 22 111 isok=`test -t 1 2>&1 | wc -c` … … 366 455 tmp="localhost" 367 456 fi 368 echo "$tmp" 457 # 458 # first one is hostname, others are aliases 459 # 460 tmp2=`cat /etc/hosts | egrep "^ *[0123456789].* $tmp" | awk '{ print $2 }'` 461 if [ -z "$tmp2" ]; then 462 echo "$tmp" 463 else 464 echo "$tmp2" 465 fi 369 466 } 370 467
Note:
See TracChangeset
for help on using the changeset viewer.