侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

判断字符串长度是否为0

2023-11-17 星期五 / 0 评论 / 0 点赞 / 70 阅读 / 494 字

#!/bin/bash# testing string length#-n 判断长度是否非零#-z 判断长度是否为零val1=testingval2=''if [ -n "$val1" ]then e

#!/bin/bash# testing string length#-n 判断长度是否非零#-z 判断长度是否为零val1=testingval2=''if [ -n "$val1" ]then 	echo "The string $val1 is not empty"else	echo "The string $val1 is empty"fiif [ -z "$val2" ]then 	echo "The string $val2 is empty"else	echo "The string $val2 is not empty"fiif [ -z "$val3" ]then 	echo "The string $val3 is empty"else	echo "The string $val3 is not empty"fi

 

广告 广告

评论区