Oracle VM Site Review - Oracle VM Health Check
view counter

Shell/Bash script logical or boolean operators

Thanks to Sandeep for this story

Boolean AND:

Oracle VM Site Review - Oracle VM Health Check
view counter
&& or -a used to do boolean AND operations in bash/shell scripts.
To validate boolean AND condition there are two ways:
if [ $condition1 ] && [ $condition2 ]
You can also validate as
if [ $condition1 -a $condition2 ]
Boolean OR:
|| or -o used to do boolean OR operations in bash/shell scripts.
To validate boolean OR there are 2 ways:
if [ $condition1 ] || [ $condition2 ]
You can also validate boolean OR as
if [ $condition1 -o $condition2 ]
-Sany

Read the entire article at its source

view counter