Ticket #233: scripts.patch

File scripts.patch, 1.4 KB (added by elefthei, 12 years ago)

patch on trunk/locker/bin/scripts that takes care of arguments like ./scripts -start or ./scripts --start

  • /home/elefthei/SIPB/

    old new  
    88    echo 'signup-sql Sign up for a sql.mit.edu account'
    99}
    1010
    11 nchoices=`choices | wc -l`
     11case $# in
     120)
    1213
    13 echo
    14 echo "Welcome to scripts.mit.edu. Which service would you like to use?"
    15 echo
    16 choices | sed 's/^[^ ]* //' | cat -n
    17 echo
    18 printf "Please enter a number 1-%d: " "$nchoices"
    19 read num
    20 echo
     14  nchoices=`choices | wc -l`
     15
     16  echo
     17  echo "Welcome to scripts.mit.edu. Which service would you like to use?"
     18  echo
     19  choices | sed 's/^[^ ]* //' | cat -n
     20  echo
     21  printf "Please enter a number 1-%d: " "$nchoices"
     22  read num
     23  echo
     24  ;;
     25
     261)
     27  OIFS="$IFS"
     28  found=0
     29  IFS='
     30'
     31
     32  for choice in `choices`; do
     33    possibleChoice=`echo "$choice"|awk -F'[- ]' '{ print "-"$2 }'`
     34    if [ "$possibleChoice" = "$1" -o "-$possibleChoice" = "$1" ]; then
     35      num=`choices|grep -n '\'"$possibleChoice"|awk -F: '{ print $1 }'`
     36      found=1
     37      break
     38    fi
     39  done
     40  IFS="$OIFS"
     41  if [ $found -eq 0 ]; then
     42    echo "Invalid use of the scripts autoinstaller. Usage: athrun scripts scripts [OPTIONS]"
     43    exit 1
     44  fi
     45  ;;
     46*)
     47  echo "Invalid use of the scripts autoinstaller. Usage: athrun scripts scripts [OPTIONS]"
     48  exit 1
     49  ;;
     50esac
    2151
    2252attach scripts 2>/dev/null
    2353choice=`choices | sed -n "$num { s/ .*$//; p; }"`