Advanced Shell Script Programming
Conditional selection if statement
Select execution:
Note: if statement can be nested
Single branch
if judgment condition; then
condition is true branch code
fi
Double branch
if judgment condition; then
condition is true branch code
else
condition is false branch code
fi
Example: Please enter an age number, the system will prompt the corresponding prompt
[root@laobai ~#vim bitch.sh
test the results
[root @ laobai #bash bitch.sh Please input your age:22 good good work [root @ laobai #bash bitch.sh Please input your age:33 good good work [root @ laobai #bash bitch.sh Please input your age:66 free your life [root @ laobai #bash bitch.sh Please input your age:666 are you people?