"Fossies" - the Fresh Open Source Software Archive

Member "mussh/casetest.sh" (25 Oct 2011, 2383 Bytes) of package /linux/privat/old/mussh-1.0.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 
    4 while [ "$1" != "" ]; do
    5         case "$1" in
    6         ###########
    7         # OPTIONS #
    8         ###########
    9           -A)
   10                 NO_AGENT=1
   11                 shift
   12                   ;;
   13           -m*)  # -m0 .. -m999
   14                 CONCURRENT="${1#-m}"
   15         if [ -z "$CONCURRENT" -a "${2#-?*}" = "$2" ] ; then
   16             CONCURRENT=$2
   17             shift
   18         elif [ -z "$CONCURRENT" ] ; then
   19             CONCURRENT=0
   20         fi
   21         if [ "${CONCURRENT//[^0-9]/}" != "$CONCURRENT" ] ; then
   22             echo "Arguement should be numeric: $CONCURRENT" 1>&2
   23             exit 1
   24         fi
   25         shift
   26 echo "Concurrency: $CONCURRENT"
   27                   ;;
   28           -d*)
   29                 DEBUG="${1#-d}"
   30             if [ -z "$DEBUG" -a "${2#-?*}" = "$2" ] ; then 
   31                         DEBUG=$2 
   32                         shift 
   33                 elif [ -z "$DEBUG" ] ; then 
   34                         DEBUG=1 
   35                 fi 
   36                 if [ "${DEBUG//[^0-9]/}" != "$DEBUG" ] ; then 
   37                         echo "Arguement should be numeric: $DEBUG" 1>&2 
   38                         exit 1 
   39                 fi 
   40                 shift
   41 echo "Debug: $DEBUG"
   42                   ;;
   43           -v*)
   44                 TMP_ARG="${1#-v}"
   45             if [ -z "$TMP_ARG" -a "${2#-?*}" = "$2" ] ; then 
   46                         TMP_ARG=$2 
   47                         shift 
   48                 elif [ -z "$TMP_ARG" ] ; then 
   49                         TMP_ARG=1 
   50                 fi 
   51                 if [ "${TMP_ARG//[^0-9]/}" != "$TMP_ARG" ] ; then 
   52                         echo "Arguement should be numeric: $TMP_ARG" 1>&2 
   53                         exit 1 
   54                 elif [ "${TMP_ARG//[^0-3]/}" != "$TMP_ARG" ] ; then 
   55                         echo "Arguement should be between 0 and 3: $TMP_ARG" 1>&2 
   56                         exit 1 
   57                 fi 
   58                 SSH_VERBOSE="-v"
   59                 [ "$TMP_ARG" -ge 2 ] && SSH_VERBOSE="$SSH_VERBOSE -v"
   60                 [ "$TMP_ARG" -ge 3 ] && SSH_VERBOSE="$SSH_VERBOSE -v"
   61                 shift
   62 echo "Verbosity: $SSH_VERBOSE"
   63                   ;;
   64           -h)
   65                 while [ "$2" != "" -a "${2#-?*}" = "$2" ] ; do
   66                           HOSTLIST="$2
   67 $HOSTLIST"
   68                         shift
   69                 done
   70                 shift
   71                   ;;
   72           *)
   73                 echo "mussh: invalid command - \"$1\"" 1>&2
   74                 #exit 1
   75         shift
   76                 ;;
   77         esac
   78 done
   79