SlideShare a Scribd company logo
1 of 13
Vibrant Technologies
& Computers
Shell scripting COURSE
Make Career With Us!!
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Why Shell?
• The commercial UNIX used Korn Shell
• For Linux, the Bash is the default
• Why Shell?
– For routing jobs, such as system administration, without writing
programs
– However, the shell script is not efficient, therefore, can be used for
prototyping the ideas
• For example,
% ls –al | more (better format of listing
directory)
% man bash | col –b | lpr (print man page of man)
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
What is Shell?
• Shell is the interface between end user and
the Linux system, similar to the commands in
Windows
• Bash is installed as in /bin/sh
• Check the version
% /bin/sh --version
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Pipe and Redirection
• Redirection (< or >)
% ls –l > lsoutput.txt (save output to lsoutput.txt)
% ps >> lsoutput.txt (append to lsoutput.txt)
% more < killout.txt (use killout.txt as parameter to
more)
% kill -l 1234 > killouterr.txt 2 >&1 (redirect to the
same file)
% kill -l 1234 >/dev/null 2 >&1 (ignore std output)
• Pipe (|)
– Process are executed concurrently
% ps | sort | more
% ps –xo comm | sort | uniq | grep –v sh | more
% cat mydata.txt | sort | uniq | > mydata.txt
(generates an empty file !)
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Writing a Script
• Use text editor to generate the “first” file
#!/bin/sh
# first
# this file looks for the files containing POSIX
# and print it
for file in *
do
if grep –q POSIX $file
then
echo $file
fi
done
exit 0
% /bin/sh first
% chmod +x first
%./first (make sure . is include in PATH
parameter)
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Syntax
• Variables
• Conditions
• Control
• Lists
• Functions
• Shell Commands
• Result
• Document
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Environment Variables
• $HOME home directory
• $PATH path
• $PS1 第一層提示符號 (normally %)
• $PS2 第二層提示符號 (normally >)
• $$ process id of the script
• $# number of input parameters
• $0 name of the script file
• $IFS separation character (white space)
• Use „env‟ to check the value
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Loop Structure
• Use wildcard „*‟
#!/bin/sh
for file in $(ls f*.sh); do
lpr $file
done
exit 0
Print all f*.sh files
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Regular Expressions
• Search for lines ending with “e”
% grep e$ words2.txt
• Search for “a”
% grep a[[:blank:]] word2.txt
• Search for words starting with “Th.”
% grep Th.[[:blank:]] words2.txt
• Search for lines with 10 lower case characters
% grep –E [a-z]{10} words2.txt
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Command
• $(command) to execute command in a script
• Old format used “`” but it can be confused with
“‟”
#!/bin/sh
echo The current directory is $PWD
echo the current users are $(who)
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Arithmetic Expansion
• Use $((…)) instead of expr to evaluate arithmetic equation
#!/bin/sh
x=0
while [ “$x” –ne 10]; do
echo $x
x=$(($x+1))
done
exit 0
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Debug
• sh –n<script> set -o noexec check syntax
set –n
• sh –v<script> set -o verbose echo command before
set –v
• sh –x<script> set –o trace echo command after
set –x
set –o nounset gives error if undefined
set –x
set –o xtrace
set +o xtrace
trap „echo Exiting: critical variable =$critical_variable‟
EXIT
B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
shellscriptingtraining.vibranttechnologies.co.in
enquiry@vibrantgroup.co.in
shellscriptingtraining.vibranttechnologies.co.in
Where to Get More Information
Vibrant Group:
www.vibrantgroup.co.in
Vibrant Technologies & Computers
www.vibranttechnologies.co.in/technologies.vibrantgroup.co.
in
Vibrant HR Team
www.hr.vibrangroup.co.in

More Related Content

What's hot

Highload осень 2012 лекция 1
Highload осень 2012 лекция 1Highload осень 2012 лекция 1
Highload осень 2012 лекция 1Technopark
 
Chromium Embedded Framework + Go at Brooklyn JS
Chromium Embedded Framework + Go at Brooklyn JSChromium Embedded Framework + Go at Brooklyn JS
Chromium Embedded Framework + Go at Brooklyn JSquirkey
 
Let's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScriptLet's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScriptSarahKowalik
 
LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js drshade
 
Automating WordPress Theme Development
Automating WordPress Theme DevelopmentAutomating WordPress Theme Development
Automating WordPress Theme DevelopmentHardeep Asrani
 
Angular js活用事例:filydoc
Angular js活用事例:filydocAngular js活用事例:filydoc
Angular js活用事例:filydocKeiichi Kobayashi
 
CSS in JSの話 #friday13json
CSS in JSの話 #friday13jsonCSS in JSの話 #friday13json
CSS in JSの話 #friday13jsonYukiya Nakagawa
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglKilian Valkhof
 
Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Yuriko IKEDA
 
Conquering the command line for code hackers
Conquering the command line for code hackersConquering the command line for code hackers
Conquering the command line for code hackersPavan M
 
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could giveN hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could giveWoonsan Ko
 
루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날Sukjoon Kim
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS IntroNgoc Dao
 

What's hot (19)

FPBrno 2018-05-22: Reason intro
FPBrno 2018-05-22: Reason introFPBrno 2018-05-22: Reason intro
FPBrno 2018-05-22: Reason intro
 
ZSH and RVM
ZSH and RVMZSH and RVM
ZSH and RVM
 
Highload осень 2012 лекция 1
Highload осень 2012 лекция 1Highload осень 2012 лекция 1
Highload осень 2012 лекция 1
 
Chromium Embedded Framework + Go at Brooklyn JS
Chromium Embedded Framework + Go at Brooklyn JSChromium Embedded Framework + Go at Brooklyn JS
Chromium Embedded Framework + Go at Brooklyn JS
 
Let's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScriptLet's talk ChatOps - Hubot with less CoffeeScript
Let's talk ChatOps - Hubot with less CoffeeScript
 
LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js
 
Automating WordPress Theme Development
Automating WordPress Theme DevelopmentAutomating WordPress Theme Development
Automating WordPress Theme Development
 
Angular js活用事例:filydoc
Angular js活用事例:filydocAngular js活用事例:filydoc
Angular js活用事例:filydoc
 
CSS in JSの話 #friday13json
CSS in JSの話 #friday13jsonCSS in JSの話 #friday13json
CSS in JSの話 #friday13json
 
Banquet 36
Banquet 36Banquet 36
Banquet 36
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webgl
 
Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境
 
Conquering the command line for code hackers
Conquering the command line for code hackersConquering the command line for code hackers
Conquering the command line for code hackers
 
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could giveN hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
 
Como o Javascript Funciona - TDC Floripa
Como o Javascript Funciona - TDC FloripaComo o Javascript Funciona - TDC Floripa
Como o Javascript Funciona - TDC Floripa
 
Hgignore global
Hgignore globalHgignore global
Hgignore global
 
루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
 
Comets notes
Comets notesComets notes
Comets notes
 

Similar to Shell Scripting-training-course-navi-mumbai-shell-scripting-course-provider-navi-mumbai

Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...anshkhurana01
 
PASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksPASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksKellyn Pot'Vin-Gorman
 
Building CLIs with Ruby
Building CLIs with RubyBuilding CLIs with Ruby
Building CLIs with Rubydrizzlo
 
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality  in the Worst Language I Know: BashGeecon 2019 - Taming Code Quality  in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality in the Worst Language I Know: BashMichał Kordas
 
Lets make better scripts
Lets make better scriptsLets make better scripts
Lets make better scriptsMichael Boelen
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassLucien Lee
 
QConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an OrganisationQConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an OrganisationChris Swan
 
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdfAll Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdfChris Swan
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 
Bridging the gap between designers and developers at the Guardian
Bridging the gap between designers and developers at the GuardianBridging the gap between designers and developers at the Guardian
Bridging the gap between designers and developers at the GuardianKaelig Deloumeau-Prigent
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGuillaume Laforge
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHiroshi SHIBATA
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
Tested and Correct, How to Make Sure Your Documentation Keeps Working
Tested and Correct, How to Make Sure Your Documentation Keeps WorkingTested and Correct, How to Make Sure Your Documentation Keeps Working
Tested and Correct, How to Make Sure Your Documentation Keeps WorkingAdam Dangoor
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your CodeNate Abele
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0Nate Abele
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)PayalHarne
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
PHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding stylePHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding styleBo-Yi Wu
 
PVS-Studio and static code analysis technique
PVS-Studio and static code analysis techniquePVS-Studio and static code analysis technique
PVS-Studio and static code analysis techniqueAndrey Karpov
 

Similar to Shell Scripting-training-course-navi-mumbai-shell-scripting-course-provider-navi-mumbai (20)

Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
 
PASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksPASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and Tricks
 
Building CLIs with Ruby
Building CLIs with RubyBuilding CLIs with Ruby
Building CLIs with Ruby
 
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality  in the Worst Language I Know: BashGeecon 2019 - Taming Code Quality  in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
 
Lets make better scripts
Lets make better scriptsLets make better scripts
Lets make better scripts
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
QConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an OrganisationQConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an Organisation
 
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdfAll Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Bridging the gap between designers and developers at the Guardian
Bridging the gap between designers and developers at the GuardianBridging the gap between designers and developers at the Guardian
Bridging the gap between designers and developers at the Guardian
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
Tested and Correct, How to Make Sure Your Documentation Keeps Working
Tested and Correct, How to Make Sure Your Documentation Keeps WorkingTested and Correct, How to Make Sure Your Documentation Keeps Working
Tested and Correct, How to Make Sure Your Documentation Keeps Working
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
PHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding stylePHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding style
 
PVS-Studio and static code analysis technique
PVS-Studio and static code analysis techniquePVS-Studio and static code analysis technique
PVS-Studio and static code analysis technique
 

More from VibrantGroup

Zend training-course-navi-mumbai-zend-course-provider-navi-mumbai
Zend training-course-navi-mumbai-zend-course-provider-navi-mumbaiZend training-course-navi-mumbai-zend-course-provider-navi-mumbai
Zend training-course-navi-mumbai-zend-course-provider-navi-mumbaiVibrantGroup
 
Weblogic Application Server training-course-navi-mumbai-weblogic application ...
Weblogic Application Server training-course-navi-mumbai-weblogic application ...Weblogic Application Server training-course-navi-mumbai-weblogic application ...
Weblogic Application Server training-course-navi-mumbai-weblogic application ...VibrantGroup
 
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...VibrantGroup
 
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiSiebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiVibrantGroup
 
Oracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbai
Oracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbaiOracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbai
Oracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbaiVibrantGroup
 
Netbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbai
Netbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbaiNetbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbai
Netbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbaiVibrantGroup
 
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbaiMainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbaiVibrantGroup
 
Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...
Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...
Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...VibrantGroup
 
Datastage training-course-navi-mumbai-datastage-course-provider-navi-mumbai
Datastage training-course-navi-mumbai-datastage-course-provider-navi-mumbaiDatastage training-course-navi-mumbai-datastage-course-provider-navi-mumbai
Datastage training-course-navi-mumbai-datastage-course-provider-navi-mumbaiVibrantGroup
 
Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...
Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...
Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...VibrantGroup
 
Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...
Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...
Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...VibrantGroup
 

More from VibrantGroup (11)

Zend training-course-navi-mumbai-zend-course-provider-navi-mumbai
Zend training-course-navi-mumbai-zend-course-provider-navi-mumbaiZend training-course-navi-mumbai-zend-course-provider-navi-mumbai
Zend training-course-navi-mumbai-zend-course-provider-navi-mumbai
 
Weblogic Application Server training-course-navi-mumbai-weblogic application ...
Weblogic Application Server training-course-navi-mumbai-weblogic application ...Weblogic Application Server training-course-navi-mumbai-weblogic application ...
Weblogic Application Server training-course-navi-mumbai-weblogic application ...
 
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
 
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiSiebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
 
Oracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbai
Oracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbaiOracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbai
Oracle11g training-course-navi-mumbai-oracle11gl-course-provider-navi-mumbai
 
Netbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbai
Netbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbaiNetbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbai
Netbackup training-course-navi-mumbai-netbackup-course-provider-navi-mumbai
 
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbaiMainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
 
Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...
Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...
Jboss Application Server training-course-navi-mumbai-jboss-course-provider-na...
 
Datastage training-course-navi-mumbai-datastage-course-provider-navi-mumbai
Datastage training-course-navi-mumbai-datastage-course-provider-navi-mumbaiDatastage training-course-navi-mumbai-datastage-course-provider-navi-mumbai
Datastage training-course-navi-mumbai-datastage-course-provider-navi-mumbai
 
Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...
Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...
Aix admin-course-provider-navi-mumbai | Aix admin course provider Navi Mumbai...
 
Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...
Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...
Aix admin course provider Navi Mumbai | AIX Admin Course Training Navi Mumbai...
 

Recently uploaded

ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 

Recently uploaded (20)

ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 

Shell Scripting-training-course-navi-mumbai-shell-scripting-course-provider-navi-mumbai

  • 1. Vibrant Technologies & Computers Shell scripting COURSE Make Career With Us!! B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173
  • 2. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Why Shell? • The commercial UNIX used Korn Shell • For Linux, the Bash is the default • Why Shell? – For routing jobs, such as system administration, without writing programs – However, the shell script is not efficient, therefore, can be used for prototyping the ideas • For example, % ls –al | more (better format of listing directory) % man bash | col –b | lpr (print man page of man)
  • 3. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in What is Shell? • Shell is the interface between end user and the Linux system, similar to the commands in Windows • Bash is installed as in /bin/sh • Check the version % /bin/sh --version
  • 4. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Pipe and Redirection • Redirection (< or >) % ls –l > lsoutput.txt (save output to lsoutput.txt) % ps >> lsoutput.txt (append to lsoutput.txt) % more < killout.txt (use killout.txt as parameter to more) % kill -l 1234 > killouterr.txt 2 >&1 (redirect to the same file) % kill -l 1234 >/dev/null 2 >&1 (ignore std output) • Pipe (|) – Process are executed concurrently % ps | sort | more % ps –xo comm | sort | uniq | grep –v sh | more % cat mydata.txt | sort | uniq | > mydata.txt (generates an empty file !)
  • 5. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Writing a Script • Use text editor to generate the “first” file #!/bin/sh # first # this file looks for the files containing POSIX # and print it for file in * do if grep –q POSIX $file then echo $file fi done exit 0 % /bin/sh first % chmod +x first %./first (make sure . is include in PATH parameter)
  • 6. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Syntax • Variables • Conditions • Control • Lists • Functions • Shell Commands • Result • Document
  • 7. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Environment Variables • $HOME home directory • $PATH path • $PS1 第一層提示符號 (normally %) • $PS2 第二層提示符號 (normally >) • $$ process id of the script • $# number of input parameters • $0 name of the script file • $IFS separation character (white space) • Use „env‟ to check the value
  • 8. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Loop Structure • Use wildcard „*‟ #!/bin/sh for file in $(ls f*.sh); do lpr $file done exit 0 Print all f*.sh files
  • 9. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Regular Expressions • Search for lines ending with “e” % grep e$ words2.txt • Search for “a” % grep a[[:blank:]] word2.txt • Search for words starting with “Th.” % grep Th.[[:blank:]] words2.txt • Search for lines with 10 lower case characters % grep –E [a-z]{10} words2.txt
  • 10. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Command • $(command) to execute command in a script • Old format used “`” but it can be confused with “‟” #!/bin/sh echo The current directory is $PWD echo the current users are $(who)
  • 11. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Arithmetic Expansion • Use $((…)) instead of expr to evaluate arithmetic equation #!/bin/sh x=0 while [ “$x” –ne 10]; do echo $x x=$(($x+1)) done exit 0
  • 12. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Debug • sh –n<script> set -o noexec check syntax set –n • sh –v<script> set -o verbose echo command before set –v • sh –x<script> set –o trace echo command after set –x set –o nounset gives error if undefined set –x set –o xtrace set +o xtrace trap „echo Exiting: critical variable =$critical_variable‟ EXIT
  • 13. B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173 shellscriptingtraining.vibranttechnologies.co.in enquiry@vibrantgroup.co.in shellscriptingtraining.vibranttechnologies.co.in Where to Get More Information Vibrant Group: www.vibrantgroup.co.in Vibrant Technologies & Computers www.vibranttechnologies.co.in/technologies.vibrantgroup.co. in Vibrant HR Team www.hr.vibrangroup.co.in