- #!/bin/bash
- export PROCNAME=test
- export TABLE_ID=0
- if [ ${TABLE_ID} -eq "" ]; then
- echo hello
- fi
以上抛出错误:
[: -eq: unary operator expected
如何使用双方括号[[${TABLE_ID} -eq“”]]来解决这个问题.
用=测试字符串相等性.
- #!/bin/bash
- export PROCNAME=test
- export TABLE_ID=0
- if [ "${TABLE_ID}" = "" ]; then
- echo hello
- fi