SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Team
Md. Iftiar Uddin Ahmed [011 122 084 ]
Md.Tanvir Hossain [ 011 101 035]
Rafid asrar prottoy [ 011 132 124 ]
Amit ghosh [011 132 134]
About Shell | Shell Scripts
Overview
 A short history of Linux
 About Shell
 About Shell Script
Linux
Introduction
 In 80’s, Microsoft’s DOS was the dominated OS for PC
 Apple MAC was better, but expensive
 UNIX was much better, but much, much more
expensive. Only for minicomputer for commercial
applications
 People was looking for a UNIX based system, which is
cheaper and can run on PC
 Both DOS, MAC and UNIX were proprietary, i.e., the
source code of their kernel is protected
 No modification is possible without paying high license
fees
Before
Linux
Beginning of
Linux
 A famous professor Andrew Tanenbaum developed Minix,
a simplified version of UNIX that runs on PC
 Minix is for class teaching only. No intention for
commercial use
 In Sept 1991, Linus Torvalds, a second year student of
Computer Science at the University of Helsinki,
developed the preliminary kernel of Linux, known as
Linux version 0.0.1
Linux
Introduction
Linux
Introduction
 Linux has been used for many computing platforms
– PC, PDA, Supercomputer,…
 Not only character user interface but graphical user interface is
available
 Commercial vendors moved in Linux itself to provide freely
distributed code. They make their money by compiling up
various software and gathering them in a distributable format
– Red Hat, Slackware, etc
Linux
Today
Shell
Shell is an command language interpreter that executes
commands read from the standard input device (keyboard) or from a
file. Shell is not part of system kernel, but uses the system kernel to
execute programs, create files etc.
Simply put, the shell is a program that takes your commands from
the keyboard and gives them to the operating system to perform.
What is Shell
Shell
Commands
 Shell commands are interpreted directly by the
shell you specify.
 The commands are similar to the statement in
some programming languages, such as C.
 Popular shells include:
 Enhanced C-shell tchs (csh+)
 Bourne-Again Shell, bash (sh+)
 Korn Shell (ksh)
Shells’
Features
 In particular:
 Pass arguments to your script
 Set and reference variables
 Use of control flow
 Interact with the user (read user input)
 Comments…
 Info on commands a given shell offers can be found
in the man pages for that shell.
 There are many Linux/UNIX references that give
detailed information and tips.
Shell Scripts
 To automate certain common activities an user
performs routinely.
 They serve the same purpose as batch files in
DOS/Windows.
 Example:
 rename 1000 files from upper case to
lowercase
What are they for?
What are Shell
Scripts
 Just text/ASCII files with:
 a set of standard UNIX/Linux commands (ls,
mv, cp, less, cat, etc.) along with
 flow of control
 some conditional logic and branching
(if-then),
 loop structures (foreach, for, while), and
 I/O facilities (echo, print, set, ...).
 They allow use of variables.
 They are interpreted by a shell directly.
 Some of them (csh, tcsh) share some of C
syntax.
 DOS/Win equivalent - batch files (.bat)
Why not use
C/C++ for
that?
 C/C++ programming requires compilation and
linkage, maybe libraries, which may not be
available (production servers).
 For the typical tasks much faster in development,
debugging, and maintenance (because they are
interpreted and do not require compilation).
Shell Script
Invocation
 Specify the shell directly:
 % tcsh myshellscript
 % tcsh -v myshellscript
(-v = verbose, useful for debugging)
 Make the shell an executable first and then run is a
command (set up an execution permission):
 % chmod u+x myshellscript
 Then either this:
 % myshellscript
(if the path variable has ‘.’ in it; security issue!)
 Or:
 % ./myshellscript
(should always work)
Shell Script
Invocation
continue
 If you get an error:
“myshellscrip: command not found”
 The probably “.” is not in your path or there’s no
execution bit set.
 When writing scripts, choose unique names, that
preferably do not match system commands.
 Bad name would be test for example, since there
are many shells with this internal command.
 To disambiguate, always precede the shell with “./” or
absolute path in case you have to name your thing not
very creatively.
Start Writing a
Shell Script
 The very first line, often called 'shebang' (#!) should
precede any other line, to assure that the right shell is
invoked.
 Comments start with '#', with the exception of #!, $#,
which are a special character sequences.
 Everything on a line after # is ignored if # is not a part
of a quoted string or a special character sequence.
#!/bin/tcsh #!/bin/bash
# This is for tcsh # For Bourne-Again Shell
#!/bin/sh
# This is for Bourne Shell
Variables
 Variables start with a $ sign when they are used.
 $x, $val
 There's no $ when a variable is declared.
 set x = 3
 @ y = 1
 set input = "$<"
 There are some system, predefined variables:
 $0, $1, $3 .... - argument references (arguments
themselves)
 $* - all the arguments
 $< - user's input from STDIN
 $# - # of arguments passed to the script
Read
 To read user input from keyboard and store it into a
 variable use read var1,var2,.....varn
#!/bin/bash
echo ‐n "Enter your name:”
read name
echo ‐n "Enter your student no:”
read stdno
echo "Your Name:$name”
echo "Your Age:$stdno”
Shell
Arithmetic
 The expr command evaluates its arguments as an
 expression.
 It is commonly used for simple arithmetic operations.
#!/bin/bash expr 1 + 1 expr 1 ‐ 1 expr 1 * 1 expr
1 / 1
va r=`expr 1 + 1`
x=1
x=`expr $x + 1`
Shell
Arithmetic
Continue
if
if ( <expression> ) then
<statements>
else if ( <another-expression> ) then
<statements>
else
<statements>
endif
foreach
foreach var ( <list-of-values> )
<statements>
end
Switch
switch ( string )
case str1:
<statements>
breaksw
...
default:
<statements>
breaksw
endsw
while
while ( <expression> )
<statements>
end
File Inquiry
Operators:
-op file
r Read access
w Write access
xExecute access
eExistence
oOwnership
z Zero size
s Non-zero size
F Plain file
D Directory
L Symbolic link
B Block special file
C Character special file
P Named pipe (FIFO)
S Socket special file

Weitere ähnliche Inhalte

Was ist angesagt?

Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
Raghu nath
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
Rahul Pola
 
Shell programming 1.ppt
Shell programming  1.pptShell programming  1.ppt
Shell programming 1.ppt
Kalkey
 
Bash shell
Bash shellBash shell
Bash shell
xylas121
 

Was ist angesagt? (20)

Shellscripting
ShellscriptingShellscripting
Shellscripting
 
Shell programming
Shell programmingShell programming
Shell programming
 
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
Shell scriptingShell scripting
Shell scripting
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
Unix
UnixUnix
Unix
 
Shell programming 1.ppt
Shell programming  1.pptShell programming  1.ppt
Shell programming 1.ppt
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Suman bhatt
Suman bhattSuman bhatt
Suman bhatt
 
Linux Shell Basics
Linux Shell BasicsLinux Shell Basics
Linux Shell Basics
 
Bash shell
Bash shellBash shell
Bash shell
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Unix shell scripts
Unix shell scriptsUnix shell scripts
Unix shell scripts
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash script
 

Ähnlich wie Shell & Shell Script

Using Unix
Using UnixUsing Unix
Using Unix
Dr.Ravi
 
Introduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiiIntroduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkii
cmdept1
 
Unix Shell Script
Unix Shell ScriptUnix Shell Script
Unix Shell Script
student
 
Unix Basics
Unix BasicsUnix Basics
Unix Basics
Dr.Ravi
 
The Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxThe Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docx
SUBHI7
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linux
Norberto Angulo
 

Ähnlich wie Shell & Shell Script (20)

UnixShells.ppt
UnixShells.pptUnixShells.ppt
UnixShells.ppt
 
60761 linux
60761 linux60761 linux
60761 linux
 
Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02
 
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
 
Chap06
Chap06Chap06
Chap06
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
 
Introduction-to-Linux.pptx
Introduction-to-Linux.pptxIntroduction-to-Linux.pptx
Introduction-to-Linux.pptx
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
 
Introduction-to-Linux.pptx
Introduction-to-Linux.pptxIntroduction-to-Linux.pptx
Introduction-to-Linux.pptx
 
Introduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiiIntroduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkii
 
Unix Shell Script
Unix Shell ScriptUnix Shell Script
Unix Shell Script
 
Chapter 2 unix system commands
Chapter 2 unix system commandsChapter 2 unix system commands
Chapter 2 unix system commands
 
cisco
ciscocisco
cisco
 
3. intro
3. intro3. intro
3. intro
 
Unix Basics
Unix BasicsUnix Basics
Unix Basics
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02
 
The Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxThe Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docx
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linux
 

Mehr von Amit Ghosh (12)

Custom object detection using Deep Learning
Custom object detection using Deep Learning Custom object detection using Deep Learning
Custom object detection using Deep Learning
 
Data Set Analysis
Data Set Analysis Data Set Analysis
Data Set Analysis
 
Cloud platform comparison
Cloud platform comparison Cloud platform comparison
Cloud platform comparison
 
Gitlab runner in aws
Gitlab runner in aws Gitlab runner in aws
Gitlab runner in aws
 
MongoDB Aggregation
MongoDB Aggregation MongoDB Aggregation
MongoDB Aggregation
 
Restaurant ordering system
Restaurant ordering systemRestaurant ordering system
Restaurant ordering system
 
System Analysis And Development Course
System Analysis And Development Course System Analysis And Development Course
System Analysis And Development Course
 
Bumble bee
Bumble beeBumble bee
Bumble bee
 
Convex hull presentation
Convex hull presentation Convex hull presentation
Convex hull presentation
 
Smart City Hackathon Presentation
Smart City Hackathon PresentationSmart City Hackathon Presentation
Smart City Hackathon Presentation
 
Pattern presentation
Pattern presentationPattern presentation
Pattern presentation
 
System call (Fork +Exec)
System call (Fork +Exec)System call (Fork +Exec)
System call (Fork +Exec)
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Kürzlich hochgeladen (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Shell & Shell Script

  • 1. Team Md. Iftiar Uddin Ahmed [011 122 084 ] Md.Tanvir Hossain [ 011 101 035] Rafid asrar prottoy [ 011 132 124 ] Amit ghosh [011 132 134]
  • 2. About Shell | Shell Scripts
  • 3. Overview  A short history of Linux  About Shell  About Shell Script
  • 4. Linux Introduction  In 80’s, Microsoft’s DOS was the dominated OS for PC  Apple MAC was better, but expensive  UNIX was much better, but much, much more expensive. Only for minicomputer for commercial applications  People was looking for a UNIX based system, which is cheaper and can run on PC  Both DOS, MAC and UNIX were proprietary, i.e., the source code of their kernel is protected  No modification is possible without paying high license fees Before Linux
  • 5. Beginning of Linux  A famous professor Andrew Tanenbaum developed Minix, a simplified version of UNIX that runs on PC  Minix is for class teaching only. No intention for commercial use  In Sept 1991, Linus Torvalds, a second year student of Computer Science at the University of Helsinki, developed the preliminary kernel of Linux, known as Linux version 0.0.1 Linux Introduction
  • 6. Linux Introduction  Linux has been used for many computing platforms – PC, PDA, Supercomputer,…  Not only character user interface but graphical user interface is available  Commercial vendors moved in Linux itself to provide freely distributed code. They make their money by compiling up various software and gathering them in a distributable format – Red Hat, Slackware, etc Linux Today
  • 7. Shell Shell is an command language interpreter that executes commands read from the standard input device (keyboard) or from a file. Shell is not part of system kernel, but uses the system kernel to execute programs, create files etc. Simply put, the shell is a program that takes your commands from the keyboard and gives them to the operating system to perform. What is Shell
  • 8. Shell Commands  Shell commands are interpreted directly by the shell you specify.  The commands are similar to the statement in some programming languages, such as C.  Popular shells include:  Enhanced C-shell tchs (csh+)  Bourne-Again Shell, bash (sh+)  Korn Shell (ksh)
  • 9. Shells’ Features  In particular:  Pass arguments to your script  Set and reference variables  Use of control flow  Interact with the user (read user input)  Comments…  Info on commands a given shell offers can be found in the man pages for that shell.  There are many Linux/UNIX references that give detailed information and tips.
  • 10. Shell Scripts  To automate certain common activities an user performs routinely.  They serve the same purpose as batch files in DOS/Windows.  Example:  rename 1000 files from upper case to lowercase What are they for?
  • 11. What are Shell Scripts  Just text/ASCII files with:  a set of standard UNIX/Linux commands (ls, mv, cp, less, cat, etc.) along with  flow of control  some conditional logic and branching (if-then),  loop structures (foreach, for, while), and  I/O facilities (echo, print, set, ...).  They allow use of variables.  They are interpreted by a shell directly.  Some of them (csh, tcsh) share some of C syntax.  DOS/Win equivalent - batch files (.bat)
  • 12. Why not use C/C++ for that?  C/C++ programming requires compilation and linkage, maybe libraries, which may not be available (production servers).  For the typical tasks much faster in development, debugging, and maintenance (because they are interpreted and do not require compilation).
  • 13. Shell Script Invocation  Specify the shell directly:  % tcsh myshellscript  % tcsh -v myshellscript (-v = verbose, useful for debugging)  Make the shell an executable first and then run is a command (set up an execution permission):  % chmod u+x myshellscript  Then either this:  % myshellscript (if the path variable has ‘.’ in it; security issue!)  Or:  % ./myshellscript (should always work)
  • 14. Shell Script Invocation continue  If you get an error: “myshellscrip: command not found”  The probably “.” is not in your path or there’s no execution bit set.  When writing scripts, choose unique names, that preferably do not match system commands.  Bad name would be test for example, since there are many shells with this internal command.  To disambiguate, always precede the shell with “./” or absolute path in case you have to name your thing not very creatively.
  • 15. Start Writing a Shell Script  The very first line, often called 'shebang' (#!) should precede any other line, to assure that the right shell is invoked.  Comments start with '#', with the exception of #!, $#, which are a special character sequences.  Everything on a line after # is ignored if # is not a part of a quoted string or a special character sequence. #!/bin/tcsh #!/bin/bash # This is for tcsh # For Bourne-Again Shell #!/bin/sh # This is for Bourne Shell
  • 16. Variables  Variables start with a $ sign when they are used.  $x, $val  There's no $ when a variable is declared.  set x = 3  @ y = 1  set input = "$<"  There are some system, predefined variables:  $0, $1, $3 .... - argument references (arguments themselves)  $* - all the arguments  $< - user's input from STDIN  $# - # of arguments passed to the script
  • 17. Read  To read user input from keyboard and store it into a  variable use read var1,var2,.....varn #!/bin/bash echo ‐n "Enter your name:” read name echo ‐n "Enter your student no:” read stdno echo "Your Name:$name” echo "Your Age:$stdno”
  • 18. Shell Arithmetic  The expr command evaluates its arguments as an  expression.  It is commonly used for simple arithmetic operations. #!/bin/bash expr 1 + 1 expr 1 ‐ 1 expr 1 * 1 expr 1 / 1 va r=`expr 1 + 1` x=1 x=`expr $x + 1`
  • 20. if if ( <expression> ) then <statements> else if ( <another-expression> ) then <statements> else <statements> endif
  • 21. foreach foreach var ( <list-of-values> ) <statements> end
  • 22. Switch switch ( string ) case str1: <statements> breaksw ... default: <statements> breaksw endsw
  • 23. while while ( <expression> ) <statements> end
  • 24. File Inquiry Operators: -op file r Read access w Write access xExecute access eExistence oOwnership z Zero size s Non-zero size F Plain file D Directory L Symbolic link B Block special file C Character special file P Named pipe (FIFO) S Socket special file

Hinweis der Redaktion

  1. This is Linus Torvalds birthday 