QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 696|回复: 0

请教LINUX的 编程问题!!

[复制链接]
发表于 2003-4-22 16:12:59 | 显示全部楼层 |阅读模式
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
declare  flag="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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-9-20 19:33 , Processed in 0.050537 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表