大佬教程收集整理的这篇文章主要介绍了linux – bash空字符串比较问题,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#!/bin/bash A= test -z $A && echo "A is empty" test -n $A && echo "A is non empty" test $A && echo "A is non empty" str="" test -z $str && echo "str is empty" test -n $str && echo "str is non empty" test $str && echo "str is non empty"
令我惊讶的是,它输出:
A is empty A is non empty str is empty str is non empty
我认为它应该是
A is empty str is empty
可以任何Linux专家解释原因吗?
谢谢.
以上是大佬教程为你收集整理的linux – bash空字符串比较问题全部内容,希望文章能够帮你解决linux – bash空字符串比较问题所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。