SlideShare ist ein Scribd-Unternehmen logo
1 von 18
SHELL PROGRAMMING
Introduction to Shell   ,[object Object],[object Object],[object Object],[object Object]
Introduction to Shell When you log in, you are in one of five shells. 1. Bourne Shll –  /bin/sh  – Steve Bourne (On AT & T UNIX) 2. Bourne Again SHell –  /bin/bash  – Improved Bourne shell (On Linux) 3. C Shell –  /bin/csh  – Bill Joy (On BSD UNIX) 4. TC Shell –  /bin/tcsh  (On Linux) 5. Korn Shell –  /bin/ksh  – David Korn (On AT & T UNIX) The system administrator determines which shell you start in.
Basics ,[object Object],[object Object],[object Object],[object Object],[object Object]
Shell Scripts Example: script.sh #! /bin/sh # script.sh: Sample Shell Script echo “Welcome to Shell Programming” echo “Today’s date : `date`”  echo “This months calendar:” echo “My Shell :$ SHELL”
Shell Variables Environmental Variables: Some global environment variables are, HOME  Path to your home directory HOST  The hostname of your system LOGNAME  The name you login with PATH  Paths to be searched for  commands SHELL  The login shell you’re using PWD   Present working directory
Local Shell Variables A variable assignment is of the form  variable=value , but its evaluation requires the $ as prefix to the variable name. count=5 echo $count total=$count You can assign value of one variable to another variable echo $total Note: There should not be any space around =.  i.e. if we say x =5 then the shell interprets x as command running with the =5 as argument!
[object Object],[object Object],[object Object],[object Object],Position variables
Position variables
#! /bin/sh echo “Program Name : $0” echo “No of Arguments : $#” echo “Arguments are : $*” $ chmod +x 2.sh $ 2.sh A B C o/p     Program Name : 2.sh   No of Arguments : 3   Arguments are : A B C Position variables
Bourne Shell Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
if … then ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
for: Looping with a List for is also a repetitive structure.  Syntax: for variable in list  do Commands done  Note: list here comprises a series of character strings. Each string is assigned to variable specified.
A partial list of built-in ,[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],[object Object],[object Object],[object Object],[object Object],A partial list of built-in
System Scripts ,[object Object],[object Object],[object Object]
[object Object],[object Object],conclusions:
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
Raghu nath
 
Bash shell
Bash shellBash shell
Bash shell
xylas121
 

Was ist angesagt? (20)

Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scripting
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basics
 
Introduction to shell scripting
Introduction to shell scriptingIntroduction to shell scripting
Introduction to shell scripting
 
Shell programming
Shell programmingShell programming
Shell programming
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
Grep
GrepGrep
Grep
 
Vi editor
Vi editorVi editor
Vi editor
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Unix - An Introduction
Unix - An IntroductionUnix - An Introduction
Unix - An Introduction
 
Course 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild CardsCourse 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild Cards
 
Linux shell
Linux shellLinux shell
Linux shell
 
Bash shell
Bash shellBash shell
Bash shell
 
Linux directory structure by jitu mistry
Linux directory structure by jitu mistryLinux directory structure by jitu mistry
Linux directory structure by jitu mistry
 

Ähnlich wie Shellscripting

Ähnlich wie Shellscripting (20)

Chap06
Chap06Chap06
Chap06
 
Using Unix
Using UnixUsing Unix
Using Unix
 
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
 
Shell & Shell Script
Shell & Shell ScriptShell & Shell Script
Shell & Shell Script
 
60761 linux
60761 linux60761 linux
60761 linux
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
Licão 09 variables and arrays v2
Licão 09 variables and arrays v2Licão 09 variables and arrays v2
Licão 09 variables and arrays v2
 
Shell-Scripting-1.pdf
Shell-Scripting-1.pdfShell-Scripting-1.pdf
Shell-Scripting-1.pdf
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commands
 
Spsl by sasidhar 3 unit
Spsl by sasidhar  3 unitSpsl by sasidhar  3 unit
Spsl by sasidhar 3 unit
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdf
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
 
Ch03
Ch03Ch03
Ch03
 
Mastering unix
Mastering unixMastering unix
Mastering unix
 

Mehr von Narendra Sisodiya (9)

JavaScript Prototype and Module Pattern
JavaScript Prototype and Module PatternJavaScript Prototype and Module Pattern
JavaScript Prototype and Module Pattern
 
Project Eduvid
Project EduvidProject Eduvid
Project Eduvid
 
Develop FOSS project using Google Code Hosting
Develop FOSS project using Google Code HostingDevelop FOSS project using Google Code Hosting
Develop FOSS project using Google Code Hosting
 
Introduction to FOSS world
Introduction to FOSS worldIntroduction to FOSS world
Introduction to FOSS world
 
video tools
video toolsvideo tools
video tools
 
wireless conf
wireless confwireless conf
wireless conf
 
Openoffice
OpenofficeOpenoffice
Openoffice
 
Vi
ViVi
Vi
 
Python Presentation
Python PresentationPython Presentation
Python Presentation
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
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
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
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
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
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
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
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
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

Shellscripting

  • 2.
  • 3. Introduction to Shell When you log in, you are in one of five shells. 1. Bourne Shll – /bin/sh – Steve Bourne (On AT & T UNIX) 2. Bourne Again SHell – /bin/bash – Improved Bourne shell (On Linux) 3. C Shell – /bin/csh – Bill Joy (On BSD UNIX) 4. TC Shell – /bin/tcsh (On Linux) 5. Korn Shell – /bin/ksh – David Korn (On AT & T UNIX) The system administrator determines which shell you start in.
  • 4.
  • 5. Shell Scripts Example: script.sh #! /bin/sh # script.sh: Sample Shell Script echo “Welcome to Shell Programming” echo “Today’s date : `date`” echo “This months calendar:” echo “My Shell :$ SHELL”
  • 6. Shell Variables Environmental Variables: Some global environment variables are, HOME Path to your home directory HOST The hostname of your system LOGNAME The name you login with PATH Paths to be searched for commands SHELL The login shell you’re using PWD Present working directory
  • 7. Local Shell Variables A variable assignment is of the form variable=value , but its evaluation requires the $ as prefix to the variable name. count=5 echo $count total=$count You can assign value of one variable to another variable echo $total Note: There should not be any space around =. i.e. if we say x =5 then the shell interprets x as command running with the =5 as argument!
  • 8.
  • 10. #! /bin/sh echo “Program Name : $0” echo “No of Arguments : $#” echo “Arguments are : $*” $ chmod +x 2.sh $ 2.sh A B C o/p  Program Name : 2.sh No of Arguments : 3 Arguments are : A B C Position variables
  • 11.
  • 12.
  • 13. for: Looping with a List for is also a repetitive structure. Syntax: for variable in list do Commands done Note: list here comprises a series of character strings. Each string is assigned to variable specified.
  • 14.
  • 15.
  • 16.
  • 17.