#!/bin/bash testScript() { cat <<-"eoscript" is_uint() { case $1 in '' | *[!0-9]* ) return 1;; esac ;} is_int() { case ${1#[-+]} in '' | *[!0-9]* ) return 1;; esac ;} is_unum() { case $1 in '' | . | *[!0-9.]* | *.*.* ) return 1;; esac ;} is_num() { case ${1#[-+]} in '' | . | *[!0-9.]* | *.*.* ) return 1;; esac ;} outstr=''; for var in 1 42 -3 +42 +3. .9 3.14 +3.141 -31.4 '' . 3-3 3.1.4 3a \ a3 blah 'Good day!' ;do for func in is_uint is_int is_unum is_num ;do if $func "$var"; then outstr="$outstr"T else outstr="$outstr"F fi done ;done case $outstr in TTTTTTTTFTFTFTFTFFFTFFTTFFTTFFFTFFFTFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ) echo Success ;; * ) echo Failed ;; esac eoscript } for shell in bash dash 'busybox sh' ksh zsh "$@";do printf "%-12s " "${shell%% *}" $shell < <(testScript) 2>&1 | xargs done