Logical Operators in Shell Scripts
Here are Logical operators that are used during Shell Script.
OPERATOR DESCRIPTION
cond1 -a cond2 True if cond1 and cond2 are True(Performs AND operation)
cond1 -o cond2 True if con1 or cond2 is True (Perform OR operation)
!cond1 True if cond1 is false
Example
$ cat > rop.sh
#!/bin/bash
a=25
b=29
if [ $a -gt 20 -a $b -gt 25 ] ; then
echo "both condition stisfied"
fi
if [ $a -gt
0 comments:
Post a Comment