标题: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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-208987-1-1.html




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

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