Тёмный

Shell Scripting Tutorial for Beginners 8 - Logical 'AND' Operator 

ProgrammingKnowledge
Подписаться 1,8 млн
Просмотров 146 тыс.
50% 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 ]]
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ bit.ly/2vsuMaS ⚫️ bit.ly/2GOaeQB
Java Programming Course ➡️ bit.ly/2GEfQMf ⚫️ bit.ly/2Vvjy4a
Bash Shell Scripting Course ➡️ bit.ly/2DBVF0C ⚫️ bit.ly/2UM06vF
Linux Command Line Tutorials ➡️ bit.ly/2IXuil0 ⚫️ bit.ly/2IXukt8
C Programming Course ➡️ bit.ly/2GQCiD1 ⚫️ bit.ly/2ZGN6ej
C++ Programming Course ➡️ bit.ly/2V4oEVJ ⚫️ bit.ly/2XMvqMs
PHP Programming Course ➡️ bit.ly/2XP71WH ⚫️ bit.ly/2vs3od6
Android Development Course ➡️ bit.ly/2UHih5H ⚫️ bit.ly/2IMhVci
C# Programming Course ➡️ bit.ly/2Vr7HEl ⚫️ bit.ly/2W6RXTU
JavaFx Programming Course ➡️ bit.ly/2XMvZWA ⚫️ bit.ly/2V2CoAi
NodeJs Programming Course ➡️ bit.ly/2GPg7gA ⚫️ bit.ly/2GQYTQ2
Jenkins Course For Developers and DevOps ➡️ bit.ly/2Wd4l4W ⚫️ bit.ly/2J1B1ug
Scala Programming Tutorial Course ➡️ bit.ly/2PysyA4 ⚫️ bit.ly/2PCaVj2
Bootstrap Responsive Web Design Tutorial ➡️ bit.ly/2DFQ2yC ⚫️ bit.ly/2VoJWwH
MongoDB Tutorial Course ➡️ bit.ly/2LaCJfP ⚫️ bit.ly/2WaI7Ap
QT C++ GUI Tutorial For Beginners ➡️ bit.ly/2vwqHSZ
★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare - skillshare.eqc...
Data Science - bit.ly/2lD9h5L | bit.ly/2lI8wIl
Machine Learning - bit.ly/2WGGQpb | bit.ly/2GghLXX
Artificial Intelligence - bit.ly/2lYqaYx | bit.ly/2NmaPya
MERN Stack E-Degree Program - bit.ly/2kx2NFe | bit.ly/2lWj4no
DevOps E-degree - bit.ly/2k1PwUQ | bit.ly/2k8Ypfy
Data Analytics with R - bit.ly/2lBKqz8 | bit.ly/2lAjos3
AWS Certification Training - bit.ly/2kmLtTu | bit.ly/2lAkQL1
Projects in Java - bit.ly/2kzn25d | bit.ly/2lBMffs
Machine Learning With TensorFlow - bit.ly/2m1z3AF | bit.ly/2lBMhnA
Angular 8 - Complete Essential Guide - bit.ly/2lYvYRP
Kotlin Android Development Masterclass - bit.ly/2GcblsI
Learn iOS Programming Building Advance Projects - bit.ly/2kyX7ue
★★★ Follow ★★★
My Website - www.codebind.com
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 24   
@nomad1716
@nomad1716 4 года назад
To everyone confused with parenthesis... The quotes around a variable ensure the total number of parameters is one and preserves white-spaces. The \ - which is usually ignored and printed as a single space, gets special meaning (like one in C++) while using quotes.
@kaushalagarwal4153
@kaushalagarwal4153 7 лет назад
hello sir, in echo commands as well as some other places, sometimes u use inverted commas("") and sometimes don't. Can u plz tell when to use them
@architsch
@architsch 7 лет назад
Do we really need quotation marks around "$age"?
@varadvithalkj1716
@varadvithalkj1716 4 года назад
it worked for me without it
@haroldgar12
@haroldgar12 4 года назад
why do you put "$age" in parentheses? Can you take them out and still have the same effect?
@giorgostsilivis6771
@giorgostsilivis6771 5 лет назад
these spaces are so annoying
@guillermolupianeztapia9868
@guillermolupianeztapia9868 6 лет назад
hello, I have been following your course and I have a doubt: how would this work in case statement? I mean, when you want to accept either one or other way of typing a variable: for example when we work with months and we want to accept "jan" or "1" to value our variable. Thanks and greetings, best course of linux I've seen!
@_________________404
@_________________404 4 года назад
the syntax of this programming language is so stupid..
@lolitasalamat2598
@lolitasalamat2598 4 года назад
Jwu #€& Jjdj&# Jejsjj Sjsjjsjjj djdju hdudh/□□> */*÷€€#&@,¡♤☆♡♡○¡dhjjsnnnnb Nndnd,# HhdhJIrhs j
@lolitasalamat2598
@lolitasalamat2598 4 года назад
UakkjSNxnj£j &-& Ebhdh
@shieldjarvis7702
@shieldjarvis7702 2 года назад
True
@k8s.junior
@k8s.junior Год назад
@@shieldjarvis7702 😆
@yashtomar9695
@yashtomar9695 4 года назад
hello sir, please tell me what is the difference between [ and [[
@Andrzej3935
@Andrzej3935 8 месяцев назад
Thanks!
@jurchiks
@jurchiks 7 лет назад
Maaan, Unix and their multiple choices for everything...
@hanifecaginalp6949
@hanifecaginalp6949 4 года назад
Ben o o o 6i)unu 66ů76zz54j4n4nn4 k>(Ouzo Ouzo okul 66ů76zz54j4n4nn4 {{ich habe t
@maceman8051
@maceman8051 4 года назад
Hanife Caginalp M hum m umm yo nvm y mm y My I I’mm. M M Maybe m
@Mr.Shaw002
@Mr.Shaw002 7 лет назад
Y doesn't it work when i take the age as keyboard input
@VikramKumar-gb8xu
@VikramKumar-gb8xu 6 лет назад
#!/bin/bash read -p 'enter the age' age if [ $age -gt 18 -a $age -lt 30 ] then echo "valid age" else echo "invalid age" fi Try this code, it will work.
@tejaspatil8802
@tejaspatil8802 6 лет назад
or you can also pass argument to script
@SaurabhSingh-en3sx
@SaurabhSingh-en3sx 6 лет назад
Vikram Kumar thanks
@codecorn8030
@codecorn8030 2 года назад
can we do if [[ $age > 10 && $age
@mayankpandey2001
@mayankpandey2001 Год назад
it worked for me
Далее
Bash Scripting Tutorial for Beginners
47:57
Просмотров 491 тыс.
Help Me Celebrate! 😍🙏
00:35
Просмотров 13 млн
The Bash "test" Command Tutorial
13:51
Просмотров 13 тыс.
Coding Was HARD Until I Learned These 5 Things...
8:34
BASH scripting will change your life
14:18
Просмотров 1 млн
Vim Tips I Wish I Knew Earlier
23:00
Просмотров 67 тыс.
Advanced Bash Scripting Tutorial
1:00:27
Просмотров 80 тыс.