Bash Cheat Sheet
Comparison operators
Operator | Description | Operator | Description | |
-eq | Is equal to | -n | Is not null | |
-ne | Is not equal to | -z | Is null | |
-gt | Is greater than | -r | file exists and is readable | |
-ge | Is greater than or equal to | -e | file exists | |
-lt | Is less then | |||
-le | Is less than or equal to | |||
== | is equal to | |||
!= | is not equal to | |||
< | Is less than | |||
<= | Is less than or equal to | |||
> | Is greater then | |||
>= | Is greater than or equal to |
Variables for script arguments
Variable | Description | Variable | Description | |
$1 ... $n | Argument number | $# | Number of arguments | |
$0 | Name of the file | $? | Return value (0 = ok, > 0 = error) | |
$* | List of arguments |