[shell script] if condition and Usage

我们先来看一段shell脚本,

[ $# -lt 2 ] && {
    echo "Usage: $0 target store_dir" >&2
    exit 2
}

这段代码真的很精简,专业而成熟;

其中包含的知识点有if条件,&&技巧,{}的块语块作用,重定向;

posted @ 2013-05-13 15:11  &Flare  阅读(323)  评论(0编辑  收藏  举报