08. Shell Scripting Tutorial for Beginners - Logical 'AND' Operator

Published: 04 September 2017
on channel: MyShadowbook Programmer
38
1

The Logical AND "&&" is a boolean operator that executes following commands based on the outcome of previously executed commands.
Logical AND (&&) if [[expr1 && expr2]] Returns expr1 if it can be converted to false; otherwise, returns expr2. Thus, when used with Boolean values, && returns true if both operands are true; otherwise, returns false.

for using And operator use &&
if [ "$age" -gt 18] && ["$age" -lt 30 ]

The -a option provide an alternative compound condition test.
if [ "$age" -gt 18 -a "$age" -lt 30 ]

if [[ $condition1 && $condition2 ]] # Also works.
if [[ "$age" -gt 18 && "$age" -lt 30 ]]


On this page of the site you can watch the video online 08. Shell Scripting Tutorial for Beginners - Logical 'AND' Operator with a duration of hours minute second in good quality, which was uploaded by the user MyShadowbook Programmer 04 September 2017, share the link with friends and acquaintances, this video has already been watched 38 times on youtube and it was liked by 1 viewers. Enjoy your viewing!