Professional Documents
Culture Documents
CM 304
CM 304
CM 304
ANDHRA PRADESH
Name : A V N L Sarojini
Designation : Lecturer
Branch : Computer Engineering
Institute : A.A.N.M. & V.V.R.S.R. Poly.,
Gudlavalleru.
Year/Semester :III Semester
Subject : UNIX & C
Subject Code : CM-304
Topic : Shell Programming &
Filtering Techniques
Duration : 50 Min
Sub Topic : Shell built-in commands
Teaching Aids :PPT
CM304.18 1
Objective
CM304.18 2
Recap
CM304.18 3
Shell built-in commands
CM304.18 4
export command
CM304.18 5
export command
CM304.18 6
export command
CM304.18 7
export command
Ex:
$cat >t.sh
echo the value of x is $x
x=20
echo the value of x is $x
$x=10
$export x
X is made Global
$sh t.sh variable here
the value of x is 10
the value of x is 20
$echo $x
20 CM304.18 8
readonly command (or) unchanging variable
Ex:
$a=20
$readonly a
CM304.18 9
readonly command (or) unchanging variable
CM304.18 10
Positional Parameters
CM304.18 11
Positional Parameters
CM304.18 12
Positional Parameters
Example:
Then
$1 is assigned to 05030cm02
$2 is assigned to kumar
CM304.18 13
Positional Parameters
$cat copy.sh
cp $1 $2
cat $2
$sh copy.sh abc xyz
$cat xyz.sh
chmod 744 $1
$sh xyz.sh abc
CM304.18 15
set command (setting values to positional parameters)
CM304.18 16
set command
CM304.18 17
set command
Example:
$cat log.sh
set `who am i`
echo $1
$sh log.sh
CM304.18 19
set command
$cat mdate.sh
set `date`
echo $1 $3 $2 $6
$sh mdate.sh
CM304.18 20
shift command
CM304.18 21
shift command
Example : $shift 5
CM304.18 22
shift command
Example:
$set Everyone has the capacity to learn from mistakes. He learns
a lot from experience.
$echo $1 $2 $3 $4 $5 $6 $7 $8 $9
Everyone has the capacity to learn from mistakes.
$shift 5
$echo $1 $2 $3 $4 $5 $6 $7 $8 $9
learn from mistakes. He learns a lot from experience.
CM304.18 23
shift command
CM304.18 24
Summary
CM304.18 25
Quiz
$3=“hello”
CM304.18 26
Quiz
$3=“hello”
CM304.18 27
Quiz
CM304.18 28
Quiz
CM304.18 29
Assignment
CM304.18 30
Frequently asked Questions
CM304.18 31