一个shell程序

#! /bin/bash

if (($#  <1)) ; then
        echo “Wrong usage!”
        echo “$0 Num”
 echo “Num为输出Fibonacci级数序列的位数”
        exit 1
fi

let “count = $1-2”
a=0
b=1
echo “************Output $1 bases Fibonacci************”

echo “0”
echo “1”

while test $count -gt 0
do 
let “c=$a +$b”
echo $c
let “a = $b”
let “b = $c”
let “count-=1”
done

8 thoughts on “一个shell程序

  1. 看看什么是差距!年轻人,我说你们不是没有根据的!
    =======================
    发贴冠军
    这个月
    53 WANG Cong
    17 刘洋
    7 Guanqun.Lu
    6 孔建军
    5 A Loser
    4 赵尔凡
    2 yaya_aoyu
    2 yikaikai
    2 zhaochongri
    2 kensou.sie….

    任何时候
    1012 WANG Cong
    384 刘洋
    275 cocobe…
    222 孔建军
    143 A Loser
    135 jinmingjie8654
    121 kensou.sie….
    67 jeasun120
    54 刘伟
    53 zhaochongri

    Like

  2. 上学期研究过cocobear的shell程序,只是了解了一些皮毛.感觉它和win的批处理有点相似之处.

    新闻组的讨论人数太少,这也是小组下面面临的巨大问题.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.