Linux shell 字符串非空判断

2021-01-06  本文已影响0人  杨康chin
p=0
for i in {1..10000};do k=`cat file.${i}|grep '!'`; \
if [[ -n $k ]];then p=$((p+1)); fi; done
echo $p

查看file1~file10000中有多少含有“!”感叹号的

linux逻辑判断:https://blog.csdn.net/weixin_30826761/article/details/94855475

上一篇 下一篇

猜你喜欢

热点阅读