🐧Bash
Creating a Script
Variables
User Input
If Statement
If-Else Statement
Else-If (elif)
Conditional Operators
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 |
File Operations
-e: Returns true value if a file exists.
-f: Return true value if a file exists and regular file.
-r: Return true value if a file exists and is readable.
-w: Return true value if a file exists and is writable.
-x: Return true value if a file exists and is executable.
-d: Return true value if a file exists and is a directory.
CASE Statement
For Loop
While Loop
Functions
Last updated