0% found this document useful (0 votes)
5 views2 pages

Lab - 03 - Manual

Lab 03 of CSE 310 focuses on Bash scripting, building on previous concepts by introducing variables, operators, conditional statements, and array usage. The lab aims to familiarize students with new Linux commands, teach variable usage, and master decision-making in scripts. By the end of the lab, students will be equipped to create more dynamic and powerful Bash scripts.

Uploaded by

neonmann814
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Lab - 03 - Manual

Lab 03 of CSE 310 focuses on Bash scripting, building on previous concepts by introducing variables, operators, conditional statements, and array usage. The lab aims to familiarize students with new Linux commands, teach variable usage, and master decision-making in scripts. By the end of the lab, students will be equipped to create more dynamic and powerful Bash scripts.

Uploaded by

neonmann814
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSE 310 : Operating System Lab

Lab 03
Bash Scripting (Part - 1)
Prepared By: Ridwan Mahbub, Lecturer, CSE, BUBT

Description:
Welcome to Lab-3! In this lab, we will continue our journey through Bash scripting
and build upon the concepts covered in "Introduction to Bash Scripting - Part 1"
lab. In this session, we will explore variables, operators, and conditional statements
in Bash, allowing us to create more dynamic and powerful scripts.

Lab Objectives:
1. Familiarize yourself with new Linux commands beyond those covered in
Lab - 2.
2. Learn about variables and their usage in Bash scripts.
3. Understand different types of operators and how they work in Bash.
4. Master the concept of conditional statements for decision-making in scripts.

Lab Content:
1. Variables in Bash
a. Introduction to variables and their purpose in scripting.
b. Declaring and assigning values to variables.
c. Variable naming conventions and best practices.
d. Displaying variable values using echo and command substitution.

2. Operators in Bash
a. Arithmetic operators: +, -, *, /, %, ** (exponentiation).
b. Relational operators: -eq, -ne, -lt, -le, -gt, -ge.
c. Understanding operator precedence.
3. Array Usage in Bash
a. Introduction to arrays and their purpose in scripting.
b. Declaring and initializing arrays.
c. Accessing array elements using indexes.

4. Using if-else Statements


a. Syntax of if-else statements in Bash.
b. Making decisions based on conditions.
c. Using comparison operators with if statements.
d. Nested if statements for more complex conditions.
e. Common pitfalls and best practices when using if-else.

Conclusion:
In this lab, you have expanded your knowledge of Bash scripting by
exploring variables, operators, conditional statements, and array usage.
These powerful concepts will enable you to create more sophisticated and
efficient scripts to tackle a wide range of tasks in Linux and other Unix-like
environments. Continue to practice and explore Bash scripting to further
enhance your skills as a Linux enthusiast or administrator.

You might also like