SlideShare una empresa de Scribd logo
1 de 12
www.techvilla.org.in
TECHVILLA
www.techvilla.org.in
www.techvilla.org.in
Working with the Shell
 What is shell?
 Different shells in linux.
 Programming in shell.
 Shell vs windows cmd
www.techvilla.org.in
What’s Shell?
 It’s acts an interface between the user and OS (kernel).It’s known as “ command
interpreter”.
 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)
www.techvilla.org.in
Shell basics
 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
Kernel
Other
programs
X window
bash
csh
www.techvilla.org.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 !)
www.techvilla.org.in
Shell as a Language
 We can write a script containing many shell commands
 Interactive Program:
 grep files with POSIX string and print it
% for file in *
> do
> if grep –l POSIX $file
> then
> more $file
 fi
 done
Posix
There is a file with POSIX in it
 ‘*’ is wildcard
% more `grep –l POSIX *`
% more $(grep –l POSIX *)
% more –l POSIX * | more
www.techvilla.org.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)
www.techvilla.org.in
Syntax
 Variables
 Conditions
 Control
 Lists
 Functions
 Shell Commands
 Result
 Document
www.techvilla.org.in
Variables
 Variables needed to be declared, note it is case-sensitive (e.g. foo, FOO, Foo)
 Add ‘$’ for storing values
% salutation=Hello
% echo $salutation
Hello
% salutation=7+5
% echo $salutation
7+5
% salutation=“yes dear”
% echo $salutation
yes dear
% read salutation
Hola!
% echo $salutation
Hola!
www.techvilla.org.in
Quoting
 Edit a “vartest.sh” file
#!/bin/sh
myvar=“Hi there”
echo $myvar
echo “$myvar”
echo `$myvar`
echo $myvar
echo Enter some text
read myvar
echo ‘$myvar’ now equals $myvar
exit 0
Output
Hi there
Hi there
$myvar
$myvar
Enter some text
Hello world
$myvar now equals Hello world
www.techvilla.org.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
www.techvilla.org.in
Shell vs windows cmd
 The difference of Windows and Linux
 Case sensitive in Linux
 / in Linux
 No relationship between executable file and extension
 don't search current path
 Security policy is more strict in Linux
 link file VS shortcut

Más contenido relacionado

La actualidad más candente

Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
Sudharsan S
 
BASH Guide Summary
BASH Guide SummaryBASH Guide Summary
BASH Guide Summary
Ohgyun Ahn
 
Shell programming 1.ppt
Shell programming  1.pptShell programming  1.ppt
Shell programming 1.ppt
Kalkey
 
Bash shell
Bash shellBash shell
Bash shell
xylas121
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
Dr.Ravi
 

La actualidad más candente (20)

OpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell Scripting
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
BASH Guide Summary
BASH Guide SummaryBASH Guide Summary
BASH Guide Summary
 
Chap06
Chap06Chap06
Chap06
 
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Shell programming 1.ppt
Shell programming  1.pptShell programming  1.ppt
Shell programming 1.ppt
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Unix shell scripting
Unix shell scriptingUnix shell scripting
Unix shell scripting
 
Bash shell
Bash shellBash shell
Bash shell
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Unix - Shell Scripts
Unix - Shell ScriptsUnix - Shell Scripts
Unix - Shell Scripts
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script
 
Scripting 101
Scripting 101Scripting 101
Scripting 101
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
 

Destacado

Sistema de redes de seguridad CSS
Sistema de redes de seguridad CSSSistema de redes de seguridad CSS
Sistema de redes de seguridad CSS
Michael Castillo
 
Assignment 35 final
Assignment 35 final Assignment 35 final
Assignment 35 final
benchaisty
 
Daftar nama peserta uas paai 2013
Daftar nama peserta uas paai 2013Daftar nama peserta uas paai 2013
Daftar nama peserta uas paai 2013
Vendi Supendi
 

Destacado (20)

Self determined learning: Creating personal learning environments for lifelon...
Self determined learning: Creating personal learning environments for lifelon...Self determined learning: Creating personal learning environments for lifelon...
Self determined learning: Creating personal learning environments for lifelon...
 
Barista sponsorship
Barista sponsorshipBarista sponsorship
Barista sponsorship
 
CARTILHA CNJ.PDF
CARTILHA  CNJ.PDFCARTILHA  CNJ.PDF
CARTILHA CNJ.PDF
 
Tarjeta
TarjetaTarjeta
Tarjeta
 
Volunteer Consultants for Women's Building in San Francisco
Volunteer Consultants for Women's Building in San FranciscoVolunteer Consultants for Women's Building in San Francisco
Volunteer Consultants for Women's Building in San Francisco
 
Sistema de redes de seguridad CSS
Sistema de redes de seguridad CSSSistema de redes de seguridad CSS
Sistema de redes de seguridad CSS
 
Apresentação
ApresentaçãoApresentação
Apresentação
 
Un bello corazón
Un bello corazónUn bello corazón
Un bello corazón
 
Fotos
FotosFotos
Fotos
 
Familia
FamiliaFamilia
Familia
 
Reptiles de san san 2010
Reptiles de san san 2010 Reptiles de san san 2010
Reptiles de san san 2010
 
รายชื่อผู้มีสิทธิ์สอบสัมภาษณ์ สกอ.
รายชื่อผู้มีสิทธิ์สอบสัมภาษณ์ สกอ.รายชื่อผู้มีสิทธิ์สอบสัมภาษณ์ สกอ.
รายชื่อผู้มีสิทธิ์สอบสัมภาษณ์ สกอ.
 
Quest Radio Station
Quest Radio StationQuest Radio Station
Quest Radio Station
 
Californication tv show
Californication tv showCalifornication tv show
Californication tv show
 
Expectativas e Ilusões
Expectativas e IlusõesExpectativas e Ilusões
Expectativas e Ilusões
 
NatalyaResume2015
NatalyaResume2015NatalyaResume2015
NatalyaResume2015
 
Assignment 35 final
Assignment 35 final Assignment 35 final
Assignment 35 final
 
OER Roadmap (OE Global Pre-conference workshop)
OER Roadmap (OE Global Pre-conference workshop)OER Roadmap (OE Global Pre-conference workshop)
OER Roadmap (OE Global Pre-conference workshop)
 
Daftar nama peserta uas paai 2013
Daftar nama peserta uas paai 2013Daftar nama peserta uas paai 2013
Daftar nama peserta uas paai 2013
 
Domain game
Domain gameDomain game
Domain game
 

Similar a Raspberry pi Part 4

Best training-in-mumbai-shell scripting
Best training-in-mumbai-shell scriptingBest training-in-mumbai-shell scripting
Best training-in-mumbai-shell scripting
vibrantuser
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linux
Norberto Angulo
 
2-introduction_to_shell_scripting
2-introduction_to_shell_scripting2-introduction_to_shell_scripting
2-introduction_to_shell_scripting
erbipulkumar
 
Using Unix
Using UnixUsing Unix
Using Unix
Dr.Ravi
 

Similar a Raspberry pi Part 4 (20)

Raspberry pi Part 25
Raspberry pi Part 25Raspberry pi Part 25
Raspberry pi Part 25
 
Best training-in-mumbai-shell scripting
Best training-in-mumbai-shell scriptingBest training-in-mumbai-shell scripting
Best training-in-mumbai-shell scripting
 
Python for Linux System Administration
Python for Linux System AdministrationPython for Linux System Administration
Python for Linux System Administration
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linux
 
2-introduction_to_shell_scripting
2-introduction_to_shell_scripting2-introduction_to_shell_scripting
2-introduction_to_shell_scripting
 
60761 linux
60761 linux60761 linux
60761 linux
 
UnixShells.ppt
UnixShells.pptUnixShells.ppt
UnixShells.ppt
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Best training-in-mumbai-shell scripting
Best training-in-mumbai-shell scriptingBest training-in-mumbai-shell scripting
Best training-in-mumbai-shell scripting
 
Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
Linux command for beginners
Linux command for beginnersLinux command for beginners
Linux command for beginners
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Using Unix
Using UnixUsing Unix
Using Unix
 
2023comp90024_linux.pdf
2023comp90024_linux.pdf2023comp90024_linux.pdf
2023comp90024_linux.pdf
 
Shell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEAShell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEA
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 

Más de Techvilla

Raspberry pi Part 3
Raspberry pi Part 3Raspberry pi Part 3
Raspberry pi Part 3
Techvilla
 

Más de Techvilla (20)

Raspberry pi Part 26
Raspberry pi Part 26Raspberry pi Part 26
Raspberry pi Part 26
 
Raspberry pi Part 24
Raspberry pi Part 24Raspberry pi Part 24
Raspberry pi Part 24
 
Raspberry pi Part 23
Raspberry pi Part 23Raspberry pi Part 23
Raspberry pi Part 23
 
Raspberry pi Part 22
Raspberry pi Part 22Raspberry pi Part 22
Raspberry pi Part 22
 
Raspberry pi Part 21
Raspberry pi Part 21Raspberry pi Part 21
Raspberry pi Part 21
 
Raspberry pi Part 20
Raspberry pi Part 20Raspberry pi Part 20
Raspberry pi Part 20
 
Raspberry pi Part 19
Raspberry pi Part 19Raspberry pi Part 19
Raspberry pi Part 19
 
Raspberry pi Part 18
Raspberry pi Part 18Raspberry pi Part 18
Raspberry pi Part 18
 
Raspberry pi Part 17
Raspberry pi Part 17Raspberry pi Part 17
Raspberry pi Part 17
 
Raspberry pi Part 16
Raspberry pi Part 16Raspberry pi Part 16
Raspberry pi Part 16
 
Rasperry pi Part 15
Rasperry pi Part 15Rasperry pi Part 15
Rasperry pi Part 15
 
Rasperry pi Part 13
Rasperry pi Part 13Rasperry pi Part 13
Rasperry pi Part 13
 
Rasperry pi Part 12
Rasperry pi Part 12Rasperry pi Part 12
Rasperry pi Part 12
 
Rasperry pi Part 10
Rasperry pi Part 10Rasperry pi Part 10
Rasperry pi Part 10
 
Rasperry pi Part 9
Rasperry pi Part 9Rasperry pi Part 9
Rasperry pi Part 9
 
Rasperry pi Part 8
Rasperry pi Part 8Rasperry pi Part 8
Rasperry pi Part 8
 
Rasperry pi Part 7
Rasperry pi Part 7Rasperry pi Part 7
Rasperry pi Part 7
 
Raspberry pi Part 6
Raspberry pi Part 6Raspberry pi Part 6
Raspberry pi Part 6
 
Raspberry pi Part 5
Raspberry pi Part 5Raspberry pi Part 5
Raspberry pi Part 5
 
Raspberry pi Part 3
Raspberry pi Part 3Raspberry pi Part 3
Raspberry pi Part 3
 

Último

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Último (20)

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 

Raspberry pi Part 4

  • 2. www.techvilla.org.in Working with the Shell  What is shell?  Different shells in linux.  Programming in shell.  Shell vs windows cmd
  • 3. www.techvilla.org.in What’s Shell?  It’s acts an interface between the user and OS (kernel).It’s known as “ command interpreter”.  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)
  • 4. www.techvilla.org.in Shell basics  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 Kernel Other programs X window bash csh
  • 5. www.techvilla.org.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 !)
  • 6. www.techvilla.org.in Shell as a Language  We can write a script containing many shell commands  Interactive Program:  grep files with POSIX string and print it % for file in * > do > if grep –l POSIX $file > then > more $file  fi  done Posix There is a file with POSIX in it  ‘*’ is wildcard % more `grep –l POSIX *` % more $(grep –l POSIX *) % more –l POSIX * | more
  • 7. www.techvilla.org.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)
  • 8. www.techvilla.org.in Syntax  Variables  Conditions  Control  Lists  Functions  Shell Commands  Result  Document
  • 9. www.techvilla.org.in Variables  Variables needed to be declared, note it is case-sensitive (e.g. foo, FOO, Foo)  Add ‘$’ for storing values % salutation=Hello % echo $salutation Hello % salutation=7+5 % echo $salutation 7+5 % salutation=“yes dear” % echo $salutation yes dear % read salutation Hola! % echo $salutation Hola!
  • 10. www.techvilla.org.in Quoting  Edit a “vartest.sh” file #!/bin/sh myvar=“Hi there” echo $myvar echo “$myvar” echo `$myvar` echo $myvar echo Enter some text read myvar echo ‘$myvar’ now equals $myvar exit 0 Output Hi there Hi there $myvar $myvar Enter some text Hello world $myvar now equals Hello world
  • 11. www.techvilla.org.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
  • 12. www.techvilla.org.in Shell vs windows cmd  The difference of Windows and Linux  Case sensitive in Linux  / in Linux  No relationship between executable file and extension  don't search current path  Security policy is more strict in Linux  link file VS shortcut