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

Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
myrajendra
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
Rohit Shrivastava
 
Linux process management
Linux process managementLinux process management
Linux process management
Raghu nath
 

What's hot (20)

Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Vi editor in linux
Vi editor in linuxVi editor in linux
Vi editor in linux
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Linux basics part 1
Linux basics part 1Linux basics part 1
Linux basics part 1
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Vi editor
Vi editorVi editor
Vi editor
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Data types in C
Data types in CData types in C
Data types in C
 
Java threads
Java threadsJava threads
Java threads
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Unix OS & Commands
Unix OS & CommandsUnix OS & Commands
Unix OS & Commands
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in Linux
 

Similar to Shell programming

Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
Raghu nath
 
Using Unix
Using UnixUsing Unix
Using Unix
Dr.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.docx
SUBHI7
 
Shell Scripts
Shell ScriptsShell Scripts
Shell Scripts
Dr.Ravi
 

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
 
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
 
Shell Scripts
Shell ScriptsShell Scripts
Shell Scripts
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 

Recently uploaded (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.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
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

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