SlideShare a Scribd company logo
2
Most read
5
Most read
8
Most read
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

PPTX
Shell scripting
PDF
Course 102: Lecture 5: File Handling Internals
PPT
Shell Scripting
PDF
Intro to Linux Shell Scripting
PDF
Linux basic commands with examples
PDF
Course 102: Lecture 18: Process Life Cycle
PPTX
Linux commands
Shell scripting
Course 102: Lecture 5: File Handling Internals
Shell Scripting
Intro to Linux Shell Scripting
Linux basic commands with examples
Course 102: Lecture 18: Process Life Cycle
Linux commands

What's hot (20)

PPT
Linux basic commands
PDF
Linux systems - Linux Commands and Shell Scripting
PPTX
Linux file system
PDF
Shell scripting
PPTX
Bash shell scripting
PPTX
Basics of-linux
PPTX
PPT
Architecture of Linux
PPTX
Introduction to Linux basic
PPTX
Bash Shell Scripting
PPTX
Linux standard file system
PPTX
VI editor in unix
PDF
Shell scripting
PPTX
Linux basics
PDF
Presentation on linux
PDF
Course 102: Lecture 1: Course Overview
PPT
Learning sed and awk
ODP
Introduction to Shell script
PPTX
Linux booting Process
PDF
Course 102: Lecture 7: Simple Utilities
Linux basic commands
Linux systems - Linux Commands and Shell Scripting
Linux file system
Shell scripting
Bash shell scripting
Basics of-linux
Architecture of Linux
Introduction to Linux basic
Bash Shell Scripting
Linux standard file system
VI editor in unix
Shell scripting
Linux basics
Presentation on linux
Course 102: Lecture 1: Course Overview
Learning sed and awk
Introduction to Shell script
Linux booting Process
Course 102: Lecture 7: Simple Utilities
Ad

Viewers also liked (6)

PDF
PPT
Shell programming
PPTX
The Power of Simple: Whats New in BMC Control-M 8
PPTX
BMC Control M Advantage
PPT
Unix/Linux Basic Commands and Shell Script
PPT
Unix Shell Scripting Basics
Shell programming
The Power of Simple: Whats New in BMC Control-M 8
BMC Control M Advantage
Unix/Linux Basic Commands and Shell Script
Unix Shell Scripting Basics
Ad

Similar to Shell Scripting in Linux (20)

PPTX
Shell scrpting(payal harne)
PDF
Unixshellscript 100406085942-phpapp02
PPTX
shell script programming introduction and fundamentals
PPTX
Licão 02 shell basics bash intro
PDF
The Shell Game Part 2: What are your shell choices?
PDF
Learning the bash Shell Unix Shell Programming Third Edition Cameron Newham
PPTX
Shell programing|Shel Scripting
PDF
Unix Shell Script
PPTX
Shell & Shell Script
PPTX
Shell & Shell Script
PPT
Bash shell
PDF
Unix shell scripting tutorial
PDF
Shell scripting1232232312312312312312312
PDF
Shell-Scripting-1.pdf
PPT
Introduction to shell scripting ____.ppt
PDF
(Ebook) linux shell scripting tutorial
PDF
21bUc8YeDzZpE
PDF
21bUc8YeDzZpE
Shell scrpting(payal harne)
Unixshellscript 100406085942-phpapp02
shell script programming introduction and fundamentals
Licão 02 shell basics bash intro
The Shell Game Part 2: What are your shell choices?
Learning the bash Shell Unix Shell Programming Third Edition Cameron Newham
Shell programing|Shel Scripting
Unix Shell Script
Shell & Shell Script
Shell & Shell Script
Bash shell
Unix shell scripting tutorial
Shell scripting1232232312312312312312312
Shell-Scripting-1.pdf
Introduction to shell scripting ____.ppt
(Ebook) linux shell scripting tutorial
21bUc8YeDzZpE
21bUc8YeDzZpE

Recently uploaded (20)

PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Chapter 5: Probability Theory and Statistics
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Hindi spoken digit analysis for native and non-native speakers
PPTX
A Presentation on Touch Screen Technology
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
Zenith AI: Advanced Artificial Intelligence
Getting Started with Data Integration: FME Form 101
Group 1 Presentation -Planning and Decision Making .pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
A Presentation on Artificial Intelligence
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Chapter 5: Probability Theory and Statistics
NewMind AI Weekly Chronicles - August'25-Week II
A comparative analysis of optical character recognition models for extracting...
Heart disease approach using modified random forest and particle swarm optimi...
Hindi spoken digit analysis for native and non-native speakers
A Presentation on Touch Screen Technology
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
MIND Revenue Release Quarter 2 2025 Press Release
1 - Historical Antecedents, Social Consideration.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology

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