Linux Instructions and Operators
Linux Instructions and Operators
File-Related Operators
----------------------
These are used to test file properties.
Logical Operators
-----------------
These combine multiple conditions.
Arithmetic Operations
---------------------
Use the `expr` command or `$(( ))` for arithmetic.
# Compare numbers
if [ $a -ge $b ]; then
echo "$a is greater than or equal to $b"
else
echo "$a is less than $b"
fi
# File operations
if [ -e sample.txt ]; then
echo "sample.txt exists"
else
echo "sample.txt does not exist"
fi
# String comparison
str1="Hello"
str2="World"