#!/bin/bash a="" if [ -n "$a" ] then echo "-n $a : 字符串长度不为 0" else echo "-n $a : 字符串长度为 0" fi
输出结果为:
-n : 字符串长度为 0