| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1528 人关注过本帖
标题:Shell程序设计(学习贴)
只看楼主 加入收藏
guixiaolan
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:356
专家分:0
注 册:2006-4-20
收藏
 问题点数:0 回复次数:0 
Shell程序设计(学习贴)
#! /bin/bash

if [ -f /etc/passwd ];then echo "file exists";fi
if((30>60||40<60));then echo "u r right";fi

for index in 1 2 3 4 5
do
    if [ $index -le 2 ];then
     echo "continue"
     continue
    elif [ $index -eq 5 ];then
     echo "break"
     break
    else
     echo "$index"
    fi
done

echo -n "enter a or b:"
read letter
case "$letter" in
    a|a) echo -e "you input a \023";;
    b|b) echo "you input b";;
    *) echo "you did not enter a or b";;
esac

ps3="plese choose:"
select fruit in apple banana stop
do
    if [ "$fruit" == "" ];then
     echo -e "invalid\n"
     continue
    elif [ "$fruit" == "stop" ];then
     echo "thanks for playing"
     break
    fi
echo "you choose $fruit"
echo -e "that number is $reply\n"
done
搜索更多相关主题的帖子: 程序设计 Shell 学习 
2008-04-14 17:26
快速回复:Shell程序设计(学习贴)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014267 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved