如何判断在shell程序命令行输入的程序参数$1是否为空

如何判断在shell程序命令行输入的程序参数$1是否为空


DB_NAME=$1
if [ -z "$DB_NAME" ]
then
        echo "database no selected yet "
        DB_NAME=remotedb
else
        echo "datebase selected yet "
        echo "datebase selected yet DB_NAME=$DB_NAME"
fi

你可能感兴趣的:(shell,database)