linux shell中判断bash脚本输入的参数个数

看下面的一段程序。

#!/bin/bash

if [ $# -gt 0 ]; then
        echo "参数个数为$#个"
else
        echo "没有参数"
fi

 

posted @ 2015-01-13 16:08  KoMiles  阅读(38422)  评论(0编辑  收藏  举报