stringtest.sh
资源名称:src.rar [点击查看]
上传用户:cqgdffbw
上传日期:2021-04-27
资源大小:17k
文件大小:1k
源码类别:
驱动编程
开发平台:
Unix_Linux
- #!/bin/sh
- string1="cat"
- string2="dog"
- string3=
- if [ "$string1" != "$string2" ]
- then
- echo "$string1 is not equal to $string2"
- fi
- if [ "$string1" ]
- then
- echo "$string1 is not null"
- fi
- if [ -n "$string3" ]
- then
- echo "$string3 is not null"
- else
- echo "string3 is null"
- fi
- if [ "$string3" -a "$string1" ]
- then
- echo "string3 and string1 true"
- else
- echo "string3 and string1 false"
- fi
- if [ "$string3" -o "$string1" ]
- then
- echo "string3 or string1 true"
- else
- echo "string3 or string1 false"
- fi
- if [ -z "$string3" ]
- then
- echo "string3's length is 0"
- fi