2
#!/etc/bash
test_word=' ' # test_word includes only one space
if [[ ${test_word} =~ ^\s*$ ]]; then
echo "detect"
else
echo "not detect"
fi
结果检测到空字符串和空白字符串是
not detect
它不工作。 请让我知道如何检测它。 还是请让我知道像
if [[ -z ${var} ]]