我正在修复一些我经常看到的旧 bash 脚本
if [[ -n $VARIABLE ]]; then
语法我试图用谷歌搜索,但可以找到为什么使用“-n”,以下是我所知道的
Comparisons:
-eq equal to
-ne not equal to
-lt less than
-le less than or equal to
-gt greater than
-ge greater than or equal to
文件操作:
-s file exists and is not empty
-f file exists and is not a directory
-d directory exists
-x file is executable
-w file is writable
-r file is readable
有人会告诉我 -n 做什么吗?