如何检查字符串在bash shell中的空间 [英] how to check if a string has spaces in bash shell
本文介绍了如何检查字符串在bash shell中的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
说字符串可能会像A BCD,我怎么能检查是否有字符串中所含的单/双引号和空间?
解决方案
案$ VAR中
* \\ *)
回声匹配
;;
*)
回声不匹配
;;
ESAC
say a string might be like "a b '' c '' d", how can I check that there is single/double quote and space contained in the string?
解决方案
case "$var" in
*\ * )
echo "match"
;;
*)
echo "no match"
;;
esac
这篇关于如何检查字符串在bash shell中的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文