--- /home/elefthei/SIPB/trunk/locker/bin/scripts	2012-11-01 18:12:49.456292486 -0400
+++ /home/elefthei/SIPB/trunk_oursrc/locker/bin/scripts	2012-11-28 22:15:56.760406951 -0500
@@ -8,16 +8,46 @@
     echo 'signup-sql Sign up for a sql.mit.edu account'
 }
 
-nchoices=`choices | wc -l`
+case $# in
+0)
 
-echo
-echo "Welcome to scripts.mit.edu. Which service would you like to use?"
-echo
-choices | sed 's/^[^ ]* //' | cat -n
-echo
-printf "Please enter a number 1-%d: " "$nchoices"
-read num
-echo
+  nchoices=`choices | wc -l`
+
+  echo
+  echo "Welcome to scripts.mit.edu. Which service would you like to use?"
+  echo
+  choices | sed 's/^[^ ]* //' | cat -n
+  echo
+  printf "Please enter a number 1-%d: " "$nchoices"
+  read num
+  echo
+  ;;
+
+1)
+  OIFS="$IFS"
+  found=0
+  IFS='
+'
+
+  for choice in `choices`; do
+    possibleChoice=`echo "$choice"|awk -F'[- ]' '{ print "-"$2 }'`
+    if [ "$possibleChoice" = "$1" -o "-$possibleChoice" = "$1" ]; then
+      num=`choices|grep -n '\'"$possibleChoice"|awk -F: '{ print $1 }'`
+      found=1
+      break
+    fi
+  done
+  IFS="$OIFS"
+  if [ $found -eq 0 ]; then
+    echo "Invalid use of the scripts autoinstaller. Usage: athrun scripts scripts [OPTIONS]"
+    exit 1
+  fi
+  ;;
+*)
+  echo "Invalid use of the scripts autoinstaller. Usage: athrun scripts scripts [OPTIONS]"
+  exit 1
+  ;;
+esac
 
 attach scripts 2>/dev/null
 choice=`choices | sed -n "$num { s/ .*$//; p; }"`
