SlideShare a Scribd company logo
1 of 53
Shell Programming
What Is Kernal ? ,[object Object],[object Object],[object Object],[object Object]
Kernal con.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What Is a Shell? ,[object Object],[object Object],[object Object]
Why Use Shells ? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Kind of Shells ,[object Object],[object Object],[object Object],[object Object],[object Object]
Changing Your Default Shell ,[object Object],[object Object],[object Object],[object Object],[object Object]
This is what Shell Does for US Your Command or Sell Script Linux Shell Converted to Binary Language By Shell Now Linux Kernel Understand Your Request
Example ls date cat file.txt BASH 0100111001001 1110011000111 1111110111101 Linux Kernel Shell is an command language interpreter that executes commands read  from the standard input device (keyboard) or from a file.
The Shell as a Programming Language ,[object Object],[object Object],[object Object],[object Object]
Shell Scripting ,[object Object],[object Object]
Why to Write Shell Script ? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Practical examples where shell scripting actively used: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Create a script ,[object Object],[object Object],[object Object]
Setup executable permission ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Run a script (execute a script) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example $ vi first # # My first shell script # clear echo “This is my First script”
$ chmod 755 first $ ./first
Variables in Shell ,[object Object],[object Object],[object Object]
User defined variables (UDV) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Print or access value of UDV ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Cont… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Class work ,[object Object],[object Object],[object Object]
Shell Arithmetic ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The read Statement ,[object Object],[object Object],[object Object],echo "Your first name please:" read fname echo "Hello $fname, Lets be friend!"
Shorthand Shorthand Meaning $ ls * will show all files $ ls a* will show all files whose first name is starting with letter 'a' $ ls *.c   will show all files having extension .c $ ls ut*.c will show all files having extension .c but file name must begin with 'ut'. $ ls ?   will show all files whose names are 1 character long  $ ls fo? will show all files whose names are 3 character long and file name begin with fo $ ls [abc]*  will show all files beginning with letters a,b,c
if condition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
Example  ,[object Object],[object Object],[object Object]
Nested if-else-fi ,[object Object]
Loops in Shell Scripts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
for Loop ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example  ,[object Object]
for Loop ,[object Object],[object Object],[object Object],[object Object]
Example  ,[object Object]
Nesting of for Loop ,[object Object],[object Object],[object Object]
while loop ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example  ,[object Object],[object Object]
The case Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example  ,[object Object],[object Object]
Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example  ,[object Object],[object Object],[object Object]
Example  ,[object Object]
Cont… ,[object Object]
Example  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Cont… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Class work#2 ,[object Object]
Working with Files
[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object]
Symbol Meaning - Regular file d Directory l Link c Special file S Socket P Named pipe C character (unbuffered) device file special b block (buffered) device file special

More Related Content

What's hot (20)

Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Unix shell scripts
Unix shell scriptsUnix shell scripts
Unix shell scripts
 
Vi editor
Vi editorVi editor
Vi editor
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
UNIX Operating System ppt
UNIX Operating System pptUNIX Operating System ppt
UNIX Operating System ppt
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 

Similar to Shell programming

Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell ScriptingRaghu nath
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.pptmugeshmsd5
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Using Unix
Using UnixUsing Unix
Using UnixDr.Ravi
 
The Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxThe Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxSUBHI7
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell ScriptingJaibeer Malik
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdfharikrishnapolaki
 
34-shell-programming.ppt
34-shell-programming.ppt34-shell-programming.ppt
34-shell-programming.pptKiranMantri
 

Similar to Shell programming (20)

Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Unix
UnixUnix
Unix
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.ppt
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Chap06
Chap06Chap06
Chap06
 
The Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxThe Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docx
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdf
 
34-shell-programming.ppt
34-shell-programming.ppt34-shell-programming.ppt
34-shell-programming.ppt
 
Spsl by sasidhar 3 unit
Spsl by sasidhar  3 unitSpsl by sasidhar  3 unit
Spsl by sasidhar 3 unit
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
First steps in C-Shell
First steps in C-ShellFirst steps in C-Shell
First steps in C-Shell
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
 
60761 linux
60761 linux60761 linux
60761 linux
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Shell programming

  • 2.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. This is what Shell Does for US Your Command or Sell Script Linux Shell Converted to Binary Language By Shell Now Linux Kernel Understand Your Request
  • 10. Example ls date cat file.txt BASH 0100111001001 1110011000111 1111110111101 Linux Kernel Shell is an command language interpreter that executes commands read from the standard input device (keyboard) or from a file.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Example $ vi first # # My first shell script # clear echo “This is my First script”
  • 19. $ chmod 755 first $ ./first
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. Shorthand Shorthand Meaning $ ls * will show all files $ ls a* will show all files whose first name is starting with letter 'a' $ ls *.c   will show all files having extension .c $ ls ut*.c will show all files having extension .c but file name must begin with 'ut'. $ ls ?   will show all files whose names are 1 character long  $ ls fo? will show all files whose names are 3 character long and file name begin with fo $ ls [abc]*  will show all files beginning with letters a,b,c
  • 28.
  • 29.  
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 50.
  • 51.
  • 52.
  • 53. Symbol Meaning - Regular file d Directory l Link c Special file S Socket P Named pipe C character (unbuffered) device file special b block (buffered) device file special