• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 幾個簡單的shell,剛學,讓大家見笑了

    發表于:2007-07-04來源:作者:點擊數: 標簽:
    幾個簡單的shell,剛學,讓大家見笑了 1.加法運算,調用bc就可以實現浮點數的運算了,不過還不會判斷是否是浮點數,所以沒有加進去判斷,大家誰會請指教!!! #!/bin/bash sum=0 if (( # 2 )) #[ # -le 2 ] then echo please input two or more parametar!!! else for
    幾個簡單的shell,剛學,讓大家見笑了

    1.加法運算,調用bc就可以實現浮點數的運算了,不過還不會判斷是否是浮點數,所以沒有加進去判斷,大家誰會請指教!!!
    #!/bin/bash
    sum=0
    if (( $# < 2 )) #[ $# -le 2 ]
    then
    echo "please input two or more parametar!!!"
    else
    for i in $* #while (( $# > 0 )) until (( $# <= 0 ))
    do
    sum=`echo "scale=3; $sum + $i" | bc` #shift shift
    done #done done
    echo "the sum =$sum"
    fi


    2.實現簡單的旋轉
    #!/bin/bash
    carryon=Y
    while [ $carryon = Y ]
    do
    echo -en "-"
    sleep 1
    echo -en "\b"
    echo -en "|"
    sleep 1
    echo -en "\b"
    done

    3.創建一個文件夾,如果文件夾存在,詢問用戶是否撤除.
    #/bin/bash
    mycontinue=y
    while [ $mycontinue = y ]
    do
    echo -n "input dirname: "
    read mydirname
    if [ -d $mydirname ] #test whether the name is a existed directory,
    #then return true else false
    then
    echo -n "The directory is already exist!Delete it?y/n: "
    temp=y
    read eqtemp
    while [ $eqtemp = y ]
    do
    rmdir $mydirname
    echo "Delete suclearcase/" target="_blank" >ccsessfully!"
    break
    done
    else
    mkdir $mydirname
    echo "Create successfully!"
    fi
    echo -n "continue?y/n:"
    read mycontinue
    done


    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>