SlideShare a Scribd company logo
1 of 12
Shell Scripting
           Linux shell programming




02/26/13
Introduction
• A shell is a program constructed of shell commands
  ( $shell,$path,Ls,pwd,mkdir..)
• Shell is an environment for user interaction.But it is
  not a part of kernel.
• Shell is just like as BAT files in MS-DOS.
• By default,Bash shell is default shell for Linux.




         02/26/13
Features of Shells
• Shells are CASE SENSITIVE.
• Shells allows interaction with kernel.
• Shells allow one to create functions and pass
  arguments to them.
• Shells provide help for each and every command
  using man or help.
• Helps in automation of tasks and thus time saving




02/26/13
Types of shells
• Following types of shells are available in linux:
           Shell Name      Developer     Promp Description
                                         t

            Bash –         Brian Fox &     $    Bash is the replacement
            Bourne again   Chet Ramey           of sh shell.It provides
                                                many tools for editing
                                                and manipulating
                                                history.
           CSH - C shell Bill Joy          %    C shell has its syntax
                                                much same as that of C
                                                language.
            Some other types of shells available are KSH Korn
           shell,TCSH tenex/Tops C shell


02/26/13
Shell Scripting
• A script is defined as just a plain text file or ASCII
   file
    – with a set of linux / unix commands.
    – Flow of control
    – IO facilities
• A shell script can be created using any
 text editor like vim,emac,notepad++ etc.




 02/26/13
• Shell script allow use of variables.
• Shell scripts are interpreted directly and are not
  compiled as cc++ codes.
• Shells provide many features including loop
  constructs,arrays,variables,branches and functions.
• shells provide logic with other utilities like
  pipelining,redirection etc.
• Shells allow file and directory management features.




02/26/13
Example of Shell scripting




02/26/13
Structure of a script
• #!/bin/bash –it defines that in which shell will be used
  to run the script.
• # comments –comments can be made by using #
  symbol in a script.
• Chmod +x script.sh – to tell the linux that file is
  executable.
• ./script.sh to execute the script.
              To check current shell ,type following:
     echo $SHELL.



02/26/13
Advantages of shell scripting
• Shell script is much quicker
  than programming in any
  other languages.

• To automate the frequently
  performed tasks.

• Easy to use and understand.
  Non-geeks can also modify
  scripts.
02/26/13
Disadvantages of shell scripting
• Slow execution speed.

• Prone to costly errors.

• Compatability problems




02/26/13
References
 Shell Scripting for Unix/Linux: Shell scripting
  advantages and disadvantages
 Bash Shell Script Function Examples
 Linux Shell Scripting Tutorial - A Beginner's
  handbook
 LinuxHelp.net




02/26/13
02/26/13

More Related Content

What's hot

What's hot (20)

Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
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 command ppt
Linux command pptLinux command ppt
Linux command ppt
 
SHELL PROGRAMMING
SHELL PROGRAMMINGSHELL PROGRAMMING
SHELL PROGRAMMING
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Apache web service
Apache web serviceApache web service
Apache web service
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Introduction 2 linux
Introduction 2 linuxIntroduction 2 linux
Introduction 2 linux
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Linux commands
Linux commandsLinux commands
Linux commands
 
User and groups administrator
User  and  groups administratorUser  and  groups administrator
User and groups administrator
 
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
 
Vi editor
Vi editorVi editor
Vi editor
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linux
 

Similar to Shell Scripting in Linux

Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linuxNorberto Angulo
 
Licão 02 shell basics bash intro
Licão 02 shell basics bash introLicão 02 shell basics bash intro
Licão 02 shell basics bash introAcácio Oliveira
 
Unix Shell Script
Unix Shell ScriptUnix Shell Script
Unix Shell Scriptstudent
 
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
 
basic shell scripting syntex
basic shell scripting syntexbasic shell scripting syntex
basic shell scripting syntexKsd Che
 
(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorialjayaramprabhu
 
Bash vs C Shell vs Korn Shell | Edureka
Bash vs C Shell vs Korn Shell | EdurekaBash vs C Shell vs Korn Shell | Edureka
Bash vs C Shell vs Korn Shell | EdurekaEdureka!
 
Shell & Shell Script
Shell & Shell ScriptShell & Shell Script
Shell & Shell ScriptAmit Ghosh
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script Amit Ghosh
 
Lab 7 - Bash Script.pptx
Lab 7 - Bash Script.pptxLab 7 - Bash Script.pptx
Lab 7 - Bash Script.pptxNourhanTarek23
 
Linnux & Shell scripts Commands.pptx
Linnux & Shell scripts Commands.pptxLinnux & Shell scripts Commands.pptx
Linnux & Shell scripts Commands.pptxShanBhoharia
 

Similar to Shell Scripting in Linux (20)

Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02
 
Shell Basics
Shell BasicsShell Basics
Shell Basics
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linux
 
Licão 02 shell basics bash intro
Licão 02 shell basics bash introLicão 02 shell basics bash intro
Licão 02 shell basics bash intro
 
Unix Shell Script
Unix Shell ScriptUnix Shell Script
Unix Shell Script
 
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
 
basic shell scripting syntex
basic shell scripting syntexbasic shell scripting syntex
basic shell scripting syntex
 
UnixShells.ppt
UnixShells.pptUnixShells.ppt
UnixShells.ppt
 
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
 
Licão 05 scripts exemple
Licão 05 scripts exempleLicão 05 scripts exemple
Licão 05 scripts exemple
 
Bash vs C Shell vs Korn Shell | Edureka
Bash vs C Shell vs Korn Shell | EdurekaBash vs C Shell vs Korn Shell | Edureka
Bash vs C Shell vs Korn Shell | Edureka
 
Shell & Shell Script
Shell & Shell ScriptShell & Shell Script
Shell & Shell Script
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script
 
Lab 7 - Bash Script.pptx
Lab 7 - Bash Script.pptxLab 7 - Bash Script.pptx
Lab 7 - Bash Script.pptx
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
 
Linnux & Shell scripts Commands.pptx
Linnux & Shell scripts Commands.pptxLinnux & Shell scripts Commands.pptx
Linnux & Shell scripts Commands.pptx
 

Recently uploaded

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Recently uploaded (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

Shell Scripting in Linux

  • 1. Shell Scripting Linux shell programming 02/26/13
  • 2. Introduction • A shell is a program constructed of shell commands ( $shell,$path,Ls,pwd,mkdir..) • Shell is an environment for user interaction.But it is not a part of kernel. • Shell is just like as BAT files in MS-DOS. • By default,Bash shell is default shell for Linux. 02/26/13
  • 3. Features of Shells • Shells are CASE SENSITIVE. • Shells allows interaction with kernel. • Shells allow one to create functions and pass arguments to them. • Shells provide help for each and every command using man or help. • Helps in automation of tasks and thus time saving 02/26/13
  • 4. Types of shells • Following types of shells are available in linux: Shell Name Developer Promp Description t Bash – Brian Fox & $ Bash is the replacement Bourne again Chet Ramey of sh shell.It provides many tools for editing and manipulating history. CSH - C shell Bill Joy % C shell has its syntax much same as that of C language. Some other types of shells available are KSH Korn shell,TCSH tenex/Tops C shell 02/26/13
  • 5. Shell Scripting • A script is defined as just a plain text file or ASCII file – with a set of linux / unix commands. – Flow of control – IO facilities • A shell script can be created using any text editor like vim,emac,notepad++ etc. 02/26/13
  • 6. • Shell script allow use of variables. • Shell scripts are interpreted directly and are not compiled as cc++ codes. • Shells provide many features including loop constructs,arrays,variables,branches and functions. • shells provide logic with other utilities like pipelining,redirection etc. • Shells allow file and directory management features. 02/26/13
  • 7. Example of Shell scripting 02/26/13
  • 8. Structure of a script • #!/bin/bash –it defines that in which shell will be used to run the script. • # comments –comments can be made by using # symbol in a script. • Chmod +x script.sh – to tell the linux that file is executable. • ./script.sh to execute the script. To check current shell ,type following: echo $SHELL. 02/26/13
  • 9. Advantages of shell scripting • Shell script is much quicker than programming in any other languages. • To automate the frequently performed tasks. • Easy to use and understand. Non-geeks can also modify scripts. 02/26/13
  • 10. Disadvantages of shell scripting • Slow execution speed. • Prone to costly errors. • Compatability problems 02/26/13
  • 11. References  Shell Scripting for Unix/Linux: Shell scripting advantages and disadvantages  Bash Shell Script Function Examples  Linux Shell Scripting Tutorial - A Beginner's handbook  LinuxHelp.net 02/26/13