SlideShare a Scribd company logo
CONTROL STATEMENTS
IN
SHELL PROGRAMMING
BHATVIJETHA
CONTROL STATEMENTS
If
If(conditional_command) format1
then
<commands>
fi
If(conditional_command) format2
then
<commands>
else
<commands>
fi
if (conditional_command) format3
then
<commands>
elif(conditional_command)
then
<commands>
..
else
<commands>
fi
• If the specified <conditional_command> is
executed successfully then the commands in
between then and else will be executed.
• Otherwise if the specified
<conditional_command>is not executed
successfully then the commands in between else
and fi will be executed.
Test command
• This command is used to test the validity of its arguments . And mostly this
command is used in conditional _commands.
• This test command returns an exit status 0 if test succeeds and 1 false if the test fails.
General format is,
Test expression
String comparision :
general format is , test operation
Where the operation can be,
String 1=string2 - compares two strings ; returns true if both
are equal else return false
String1!=string2 - compares two strings; strings ; returns true
if both are equal else return false
-z string - checks whether the specified string is of zero or
not, returns true if the string is null, else return
false
-n string - checks whether the specified string is of zero
or not,returns true if the string is null,else return
false
Numerical comparision
operations meaning
-eq Returns true if number1 is equal to number2..else false.
-ne Returns true if number1 is not equal to number2 else returns false.
-gt Returns true if number1 is greater than number2 else returns false.
-lt Returns true if number1 is less than number2 else returns false.
-ge Returns true if number1 is less than number2 else returns false.
-le Returns true if number1 is less than or equal to number2 else
returns false.
General format is,
Test number1 operator number2
Case statement
This is a multi- branch control statement.
General format is,
Case value is,
Pattern1) <commands>;;
Pattern2)<commands>;;
..
patternN)<commands>;;
Esac
• This statement compares the value to the patterns from
the top to bottom , and performs the commands
associated with the matching pattern.
• The commands for each pattern must be terminated by
double semicolon.
End of presentation

More Related Content

What's hot

Stack
StackStack
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Pavith Gunasekara
 
Arrays
ArraysArrays
Data types in java
Data types in javaData types in java
Data types in java
HarshitaAshwani
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
Chandan Kumar Rana
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorial
Kuntal Bhowmick
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
Adil Mehmoood
 
Rmi ppt
Rmi pptRmi ppt
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
Tech_MX
 
Shell programming
Shell programmingShell programming
Shell programming
Moayad Moawiah
 
Java Beans
Java BeansJava Beans
Java Beans
Ankit Desai
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
Jin Castor
 
Constructor overloading & method overloading
Constructor overloading & method overloadingConstructor overloading & method overloading
Constructor overloading & method overloading
garishma bhatia
 
Java package
Java packageJava package
Java package
CS_GDRCST
 
Os Threads
Os ThreadsOs Threads
Os Threads
Salman Memon
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
Abhilash Nair
 
enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
Jitender Singh Lodhi
 
Java threads
Java threadsJava threads
Java threads
Prabhakaran V M
 

What's hot (20)

Stack
StackStack
Stack
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Arrays
ArraysArrays
Arrays
 
Data types in java
Data types in javaData types in java
Data types in java
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorial
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Shell programming
Shell programmingShell programming
Shell programming
 
Java Beans
Java BeansJava Beans
Java Beans
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Constructor overloading & method overloading
Constructor overloading & method overloadingConstructor overloading & method overloading
Constructor overloading & method overloading
 
Java package
Java packageJava package
Java package
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
 
Java threads
Java threadsJava threads
Java threads
 

Similar to LINUX:Control statements in shell programming

Shell Scripting Structured Commands
Shell Scripting Structured CommandsShell Scripting Structured Commands
Shell Scripting Structured Commands
Don Bosco BSIT
 
C++ chapter 4
C++ chapter 4C++ chapter 4
C++ chapter 4
SHRIRANG PINJARKAR
 
Unit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment exampleUnit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment example
umaghosal12101974
 
IF & SWITCH (conditional control) in computer science
IF & SWITCH (conditional control) in computer scienceIF & SWITCH (conditional control) in computer science
IF & SWITCH (conditional control) in computer science
RaianaTabitha
 
05 Conditional statements
05 Conditional statements05 Conditional statements
05 Conditional statements
maznabili
 
Control statements anil
Control statements anilControl statements anil
Control statements anil
Anil Dutt
 
2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
ManojKhadilkar1
 
Difference between switch and ladder if
Difference between switch and ladder ifDifference between switch and ladder if
Difference between switch and ladder if
Harish Gyanani
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
03a control structures
03a   control structures03a   control structures
03a control structures
Manzoor ALam
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
Syed Farjad Zia Zaidi
 
conditional.pptx
conditional.pptxconditional.pptx
conditional.pptx
AbhinayKammakol
 
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
Muhammad Hammad Waseem
 
Control Structures Python like conditions and loops
Control Structures Python like conditions and loopsControl Structures Python like conditions and loops
Control Structures Python like conditions and loops
ramireddyobulakondar
 
Flow of control by deepak lakhlan
Flow of control by deepak lakhlanFlow of control by deepak lakhlan
Flow of control by deepak lakhlan
Deepak Lakhlan
 
Selection structure
Selection structureSelection structure
Selection structure
Jyoti Pokharna
 
Conditional statement in c
Conditional statement in cConditional statement in c
Conditional statement in c
Muthuganesh S
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
ayshasafdarwaada
 
C++ problem solving operators ( conditional operators,logical operators, swit...
C++ problem solving operators ( conditional operators,logical operators, swit...C++ problem solving operators ( conditional operators,logical operators, swit...
C++ problem solving operators ( conditional operators,logical operators, swit...
mshakeel44514451
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
 

Similar to LINUX:Control statements in shell programming (20)

Shell Scripting Structured Commands
Shell Scripting Structured CommandsShell Scripting Structured Commands
Shell Scripting Structured Commands
 
C++ chapter 4
C++ chapter 4C++ chapter 4
C++ chapter 4
 
Unit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment exampleUnit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment example
 
IF & SWITCH (conditional control) in computer science
IF & SWITCH (conditional control) in computer scienceIF & SWITCH (conditional control) in computer science
IF & SWITCH (conditional control) in computer science
 
05 Conditional statements
05 Conditional statements05 Conditional statements
05 Conditional statements
 
Control statements anil
Control statements anilControl statements anil
Control statements anil
 
2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
 
Difference between switch and ladder if
Difference between switch and ladder ifDifference between switch and ladder if
Difference between switch and ladder if
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 
03a control structures
03a   control structures03a   control structures
03a control structures
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
 
conditional.pptx
conditional.pptxconditional.pptx
conditional.pptx
 
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
 
Control Structures Python like conditions and loops
Control Structures Python like conditions and loopsControl Structures Python like conditions and loops
Control Structures Python like conditions and loops
 
Flow of control by deepak lakhlan
Flow of control by deepak lakhlanFlow of control by deepak lakhlan
Flow of control by deepak lakhlan
 
Selection structure
Selection structureSelection structure
Selection structure
 
Conditional statement in c
Conditional statement in cConditional statement in c
Conditional statement in c
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
C++ problem solving operators ( conditional operators,logical operators, swit...
C++ problem solving operators ( conditional operators,logical operators, swit...C++ problem solving operators ( conditional operators,logical operators, swit...
C++ problem solving operators ( conditional operators,logical operators, swit...
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 

More from bhatvijetha

Shellvariables in Linux
Shellvariables in Linux Shellvariables in Linux
Shellvariables in Linux
bhatvijetha
 
Vi editor
Vi editorVi editor
Vi editor
bhatvijetha
 
Linux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls commandLinux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls command
bhatvijetha
 
Unix vs linux
Unix vs linuxUnix vs linux
Unix vs linux
bhatvijetha
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
bhatvijetha
 
Linux commands part4
Linux commands part4Linux commands part4
Linux commands part4
bhatvijetha
 
Linux commands part3
Linux commands part3Linux commands part3
Linux commands part3
bhatvijetha
 
Linux commands part -2
Linux commands part -2Linux commands part -2
Linux commands part -2
bhatvijetha
 
Linux commands
Linux commandsLinux commands
Linux commands
bhatvijetha
 
Introduction to unix
Introduction to unixIntroduction to unix
Introduction to unix
bhatvijetha
 

More from bhatvijetha (10)

Shellvariables in Linux
Shellvariables in Linux Shellvariables in Linux
Shellvariables in Linux
 
Vi editor
Vi editorVi editor
Vi editor
 
Linux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls commandLinux directory commands:more options on cd and ls command
Linux directory commands:more options on cd and ls command
 
Unix vs linux
Unix vs linuxUnix vs linux
Unix vs linux
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
 
Linux commands part4
Linux commands part4Linux commands part4
Linux commands part4
 
Linux commands part3
Linux commands part3Linux commands part3
Linux commands part3
 
Linux commands part -2
Linux commands part -2Linux commands part -2
Linux commands part -2
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Introduction to unix
Introduction to unixIntroduction to unix
Introduction to unix
 

Recently uploaded

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 

Recently uploaded (20)

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 

LINUX:Control statements in shell programming

  • 4. • If the specified <conditional_command> is executed successfully then the commands in between then and else will be executed. • Otherwise if the specified <conditional_command>is not executed successfully then the commands in between else and fi will be executed.
  • 5. Test command • This command is used to test the validity of its arguments . And mostly this command is used in conditional _commands. • This test command returns an exit status 0 if test succeeds and 1 false if the test fails. General format is, Test expression String comparision : general format is , test operation Where the operation can be, String 1=string2 - compares two strings ; returns true if both are equal else return false String1!=string2 - compares two strings; strings ; returns true if both are equal else return false -z string - checks whether the specified string is of zero or not, returns true if the string is null, else return false -n string - checks whether the specified string is of zero or not,returns true if the string is null,else return false
  • 6. Numerical comparision operations meaning -eq Returns true if number1 is equal to number2..else false. -ne Returns true if number1 is not equal to number2 else returns false. -gt Returns true if number1 is greater than number2 else returns false. -lt Returns true if number1 is less than number2 else returns false. -ge Returns true if number1 is less than number2 else returns false. -le Returns true if number1 is less than or equal to number2 else returns false. General format is, Test number1 operator number2
  • 7. Case statement This is a multi- branch control statement. General format is, Case value is, Pattern1) <commands>;; Pattern2)<commands>;; .. patternN)<commands>;; Esac
  • 8. • This statement compares the value to the patterns from the top to bottom , and performs the commands associated with the matching pattern. • The commands for each pattern must be terminated by double semicolon.