Logical Operators
|
|
&&
):
if [[ -f "$file" && -r "$file" ]]; then
echo "The file exists and is readable."
fi
Logical OR (
||
):if [[ -z "$var" || "$var" == "default" ]]; then
echo "The variable is either empty or set to 'default'."
fi
Logical NOT (
!
):if [[ ! -f "$file" ]]; then
echo "The file does not exist."
fi
Comments
Post a Comment