zoukankan      html  css  js  c++  java
  • for DEMO

    举例一:

    [xiluhua@vm-xiluhua][~/shell_script]$ cat forDemo1.sh
    #=======================================================================================
    #/bin/bash
    #auth: xiluhua
    #date: 20160717
    #desc: print file list in a directory
    #=======================================================================================
     
    [ -z $1 ] && echo "exception@1: directory can not be null" && exit 1
     
    echo "prompt: print file list in a directory ..."
    for file in $(ls $1/*.123)
    do 
            echo $file
    done
    exit 0

    举例二:

    [xiluhua@vm-xiluhua][~/shell_script]$ cat forDemo2.sh 
    #=======================================================================================
    #/bin/bash
    #auth: xiluhua
    #date: 20160717
    #desc: print triangle with *
    #=======================================================================================
     
    for (( i=0; i<3; i++ ))
    do
        let space=2-$i
            #echo $space
            for (( j=0; j<${space}; j++ ))
            do
                    printf " "
            done
     
            let star=2*$i+1
            for (( k=0; k<$star; k++ ))
        do
            printf "*"
        done
     
            echo ""
    done
  • 相关阅读:
    javascript --学习this
    seaJS
    wamp之htaccess的配置
    replace之$1、$2等
    nw.js使用
    新电脑开发环境配置
    vue-vue常用指令
    Array的splice与slice
    vue-入门体验
    Object.defineProperty
  • 原文地址:https://www.cnblogs.com/xiluhua/p/5678680.html
Copyright © 2011-2022 走看看