Shell Test Judgment command

Source: Internet
Author: User
Judging command test

You can use the test command to perform tests on files, strings, and so on, typically with control statements such as While,if,case

"字符串测试" ? test str1==str2 测试字符串是否相等 ? test str1!-str2 测试字符串是否不相等 ? test str1 测试字符串是否不为空 ? test -n str1 测试字符串是否不为空 ? test -z str1 测试字符串是否为空 ? "int 测试" ? test int1 -eq int2 测试整数是否相等 ? test int1 -ne int2 测试整数是否不相等 ? test int1 -ge int2 测试整数int1是否>=int2 ? test int1 -gt int2 测试整数int1是否>int2 ? test int1 -le int2 测试整数int1是否<=int2 ? test int1 -lt int2 测试整数int1是否<int2?"文件测试" ? ?test -d file 指定文件是否目录 ? ?test -f file 指定文件是否常规文件 ? ?test -x file 指定文件是否可执行 ? ?test -r file 指定文件是否可读 ? ?test -w file 指定文件是否可写

Shell Test Judgment command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.