Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

SHELL SCRIPTING BASIC CONCEPTS - environment

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 1
SHELL SCRIPTING BASIC CONCEPTS - echo

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 2
SHELL SCRIPTING BASIC CONCEPTS - echo

(Assigning temporary default values)

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 3
SHELL SCRIPTING BASIC CONCEPTS - set

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 4
SHELL SCRIPTING BASIC CONCEPTS - $

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 5
SHELL SCRIPTING BASIC CONCEPTS – Meta Characters

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 6
SHELL SCRIPTING BASIC CONCEPTS – access values

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 7
SHELL SCRIPTING BASIC CONCEPTS – fetch value

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 8
SHELL SCRIPTING BASIC CONCEPTS – fetch value

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 9
SHELL SCRIPTING BASIC CONCEPTS – export – Parent and Child Shell environment

24-01-2023 10
Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur
SHELL SCRIPTING BASIC CONCEPTS – BackSlash \

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 11
SHELL SCRIPTING BASIC CONCEPTS – Single Quotes ‘

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 12
SHELL SCRIPTING BASIC CONCEPTS – Double Quotes “

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 13
Command Substitution

• When a command is enclosed in backquotes, it will be executed and its output returned.
• This process is called command substitution.
• It is used when assigning the output of a command to a variable or when substituting the output of a command within a
string.
• All three shells use backquotes to perform command substitution

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 14
24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 15
Aim: 1. Write a shell script to perform the following string
operations:
a) integer arithmetic operations

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 16
24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 17
Aim: Write a shell script to perform the following string
operations:
i) Floating Point arithmetic operations

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 18
Aim: Write a shell script to perform the following string operations:
Integer Operation – find power of a number

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 19
Aim: Write a shell script to perform the following string operations:
I) To extract a sub-string from a given string.
II)To find the length of a given string.

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 20
1b. Write a shell program to find out reverse string of the given string

24-01-2023 Lecture ppt by Dr. Sumalatha Aradhya, Dept of CSE, SIT, Tumkur 21

You might also like