The "Linux command" test

Source: Internet
Author: User

1. Expression

#!/bin/bash#if test expression 1 "expression is true"ifTest 1 = = 1And then Echo ' test condition is true ' fi#if test expression 1 "equals" if [expression 1]if[1 = = 1];then echo ' [] condition is true ' fi#if test! expression 1 "expression is false"ifTest! 2 = = 1And then Echo ' test condition is false ' fi#if test expression 1-a expression 2ifTest 1 = = 1-a 2 = = 2and then echo ' expression 1 and expression 2 are true ' fi#if test expression 1-o expression 2ifTest 1 = = 1-o 2 = = 3and then echo ' expression 1 or expression 2 has a true ' fi

2. File (clip)

# /bin/bash  for inch ' ls '  Do if - F $fileName  $fileName$fileName$fileName  ' is directory ' Fidone 

The "Linux command" test

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.