Site Tools


linux:scripts:basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
linux:scripts:basics [2018/12/20 17:44] – Discussion status changed lunetikklinux:scripts:basics [2021/01/07 14:55] (current) lunetikk
Line 9: Line 9:
 |  case - esac  |  inserts case  | |  case - esac  |  inserts case  |
 |  if [ "var" == "var" ]; then fi  |  inserts if  | |  if [ "var" == "var" ]; then fi  |  inserts if  |
 +
 +==== if conditions ====
 +
 +^  Operator  ^ Description  ^
 +|  -eq  |  Returns true if two numbers are equivalent  |
 +|  -lt  |  Returns true if a number is less than another number  |
 +|  -gt  |  Returns true if a number is greater than another number  |
 +|  ==  |  Returns true if two strings are equivalent  |
 +|  !=  |  Returns true if two strings are not equivalent  |
 +|  !  |  Returns true if the expression is false  |
 +|  -d  |  Check the existence of a directory  |
 +|  -e  |  Check the existence of a file  |
 +|  -r  |  Check the existence of a file and read permission  |
 +|  -w  |  Check the existence of a file and write permission  |
 +|  -x  |  Check the existence of a file and execute permission  |
 +|  -z  |  string is null, that is, has zero length  |
 +|  -n  |  string is not null.  |
 +
 +https://tldp.org/LDP/abs/html/comparison-ops.html
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
linux/scripts/basics.1545324291.txt.gz · Last modified: 2018/12/20 17:44 by lunetikk