gaya208 发表于 2003-4-22 16:12:59

请教LINUX的 编程问题!!

1)
#!/bin/bash
clear
function dis
{    echo "*****************communication mode**********************"
   echo " "
   echo "pls select a number:"
   echo " "
   echo "1.list the e-mail address "
   echo " "
   echo "2.list the namelist &telephone number "
   echo " "
   echo "q=quit "
   echo " "
   echo "Q=quit "
   echo " "
   read no
   case $no in
       1)echo "[email protected]"
         echo "[email protected]"
         echo "[email protected]"
         echo "[email protected]"
          ;;
       2)echo "gaya208   --   38256286"
         echo "gaya      --   13642330469"
         echo "amy       --   36346262"
         echo "prince    --   13822111534"
          ;;
       q)exit 0
          ;;
       Q)exit 0
          ;;
       *)echo "sorry! your selection isn't in the list!it is a invalid no."
esac
}
dis

这个是 可以运行的.但是下面的 这个就不可以了.请帮我看看是 什么原因!!


2)


#! /bin/bash
declareflag="3"
while["$flag" -gt "1"]
   do
         clear
         echo "*****************communication mode**********************"
         echo " "
         echo "pls select a number:"
         echo " "
         echo "   1.list the e-mail address "
         echo " "
         echo "   2.list the namelist &telephone number "
         echo " "
         echo "   q=quit "
         echo " "
         echo "   Q=quit "
         echo " "
         read no
         case $no in
            1)echo "[email protected]"
                echo "[email protected]"
                echo "[email protected]"
                echo "[email protected]"
               ;;
            2)echo "gaya208   --   38256286"
                echo "gaya      --   13642330469"
                echo "amy       --   36346262"
                echo "prince    --   13822111534"
                ;;
            q)$flag=0
                ;;
            Q)$flag=0
                ;;
            *)echo "sorry! it is a invalid no."
                echo " pls try again!!"
         esac

done
页: [1]
查看完整版本: 请教LINUX的 编程问题!!