Prerequisite knowledge
- The if statement determines the exit status of the command specified in the conditional expression and branches. True if the exit status is 0, false otherwise
[ "A" = "A"]
If there is no space between [] like this, an error will occur. For example["A" = "A"]
, it is an error to write. It is easy to understand if [ is a command<,>,<=,>=
cannot be used in conditional expressions. You can use-lt(<),-gt(>),-le(<=),-ge(>=)
instead. -lt (less than), -gt (greater than), -le (less than or equal), -ge (greater than or equal), respectively. But it’s hard to understand, so I wrote it all down.- If you have any trouble , just use man
Command collection
All you can find in this repo
- Are the strings equal?
- Use > as a conditional expression → Use -gt (greater than)
- Use < in a conditional expression → Use -lt (less than)
- Use >= in a…