Judgement Structure

  
in Linux Shell

The IF/THEN structure determines whether the return value of a piece of code is 0 (according to UNIX convention, 0 means yes), if it is 0, it executes a specific code;

There is a dedicated command in the shell [ (that is, the left brace). He is synonymous with test and he was introduced to improve efficiency. This command treats his arguments as comparison statements or file test statements, and returns the corresponding value;

When version 2.2, Bash introduced the extended test command [[ ]], and his comparison with other The language is very similar; Note: [[ is a keyword, not a command, [[ ]] is a command! Bash treats [[ $a -lt $b ]] as an element and returns only one state value; the

(( )) and let… structures determine whether a mathematical expression evaluates to a non-zero The value returns the status.

IF can test any command, not just those that are expanded with braces.

Copyright © Windows knowledge All Rights Reserved