Program can be divided into:
Compiled classes: source → → compiled executable file
Script categories: interpreter bash, python, Perl, rubby
Read line, interpreted line, one line, speed is not fast program compiled class
bash syntax
1. Analyzing the formula
test expression
[ expression ]
[[ expression ]]
Note: You must be a space between the expressions in parentheses
Judgment integer
Judge of character
Objects (files, directories, links, etc.) to judge
Judgment privileges
1.1 determine the integer
-gt (greater than), - lt (less than), - ge (> =), - le (<=), - eq (=), - ne (not equal), - a (and), - o (or)
# test 10 -gt 8
# Echo $? (Output 0, that is true)
# [10 -gt 8] or [[10 -gt 8]]
# echo $?
# test 10 -gt 20
# echo $?(1)
# test 10 -eq 20
# echo $?(1)
# 10 test -do 20
# echo $?(0)
# test 10 -gt 8 -a 10 -gt 9
# echo $?(0)
# [ 10 -gt 8 -o 10 -gt 11 ]
# echo $?(0)
Example 1: The number of input 3