BWU_BTA_22_508_cSd how os are implemented.pptx

Venom789 11 views 11 slides Oct 08, 2024
Slide 1
Slide 1 of 11
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11

About This Presentation

something about os


Slide Content

NAME- RANJAN DAS STUDENT CODE- BWU/BTA/22/508 DEPARTMENT- B.TECH CSE(AIML) SEC- I SEM - 4th SUBJECT NAME- OPERATING SYSTEM SUBJECT CODE- PCC-CSM401 TOPIC NAME- SHELL PROGRAMING

Contents Introduction Type of shells Shell scripting Basics of shell scripting Uses of shell scripting

WHAT IS A SHELL A shell is a program that takes commands typed by the user and calls the operating system to run those commands. * A shell is a program that acts as the interface between you and the Linux system, allowing you to enter commands for the operating system to execute. * Shell accepts your instruction or commands in English and translate it into computers native binary language.

WHY WE USED SHELLS We can use shell scripts to automate administrative tasks. * Encapsulate complex configuration details. * Get at the full power of the operating system. * The ability to combine commands allows you to create new commands * Adding value to your operating system.

Types of shells Bourne shell C shell Korn shell Bash shell Tcsh shell

Shell Scripting Shell scripting is a way to automate tasks using the command-line shell of an operating system. The shell is a program that interprets commands and acts as an intermediary between the user and the operating system. It is a series of command stored in a plain text file. A Shell script is similar to a batch file in MS-DOS but is much more powerful than that.

Basics of Shell Scripting: Shebang Line: Every shell script should begin with a shebang line ( #! ) followed by the path to the shell interpreter. For example, #!/bin/bash indicates that the script should be executed using the Bash shell. Comments: Comments start with a # and are ignored by the shell. They are used to add explanations or documentation to the script. Variables: Variables are used to store data. They can be defined and accessed using the $ symbol. Ex-  NAME="John" echo "Hello, $NAME!"

Control structures Shell scripting supports various control structures like loops and conditionals ( if , else , elif , case ). Here's an example of an if-else statement. Ex- if [ "$NAME" == "John" ]; then     echo "Hello, John!"    else     echo "Hello, someone else!"    fi # fi used to denote the end of a conditional block.

Functions We can define functions to organize our code and reuse it. We can perform various type of operation in a program using functions. Ex- greet() {     echo "Hello, $1!" } greet "Alice" o/p- Hello, Alice. Square() {       Local num=$1       Local result=$((num * num))       echo "The square of $num is: $result" } Square 5 o/p- The square of 5 is: 25

Examples where shell scripting can be used: Monitoring Linux system Data backup & create snape shots. To find out available memory & free memory. Find out all necessary networks are running out or not.

Thank you
Tags