0% found this document useful (0 votes)
6 views25 pages

Owaiskazmi - 3745 - 21040 - 3 - LECTURE 10-v1

This lecture covers the basics of command and scripting in UNIX, focusing on background and foreground processes, as well as job management. It introduces key scripting concepts, including various operators and commands for job control, and provides examples of script execution and arithmetic operations. Additionally, it references resources for further learning on Bash scripting and command chaining.

Uploaded by

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

Owaiskazmi - 3745 - 21040 - 3 - LECTURE 10-v1

This lecture covers the basics of command and scripting in UNIX, focusing on background and foreground processes, as well as job management. It introduces key scripting concepts, including various operators and commands for job control, and provides examples of script execution and arithmetic operations. Additionally, it references resources for further learning on Bash scripting and command chaining.

Uploaded by

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

LECTURE 10

Command
&
Basics of Scripting
Objectives

1. Background and foreground process


2. Introduction of Scripting
3. Implementation

2
JOB/Process

Jobs are one or more processes that are grouped together as a


'job', where job is a UNIX shell concept. A job consists of
multiple processes running in series or parallel. A process is a
program under execution.

3
Processes/Jobs

1. Background job
2. Foreground job

4
Foreground/Background JOB

 The shell does not have to wait for a background process to end before it can run
more processes. Within the limit of the amount of memory available, you can
enter many background commands one after another.

5
Background Job

While running a job you can Shortcut


suspend a job ctrl -z
terminate a job ctrl -c

Function Command
Move a suspended job to the foreground fg
Continue a suspended job in the
bg
background
List all jobs jobs
Kill a job (%N where N is the job number) kill %N && fg
Start a job directly in the background command &
Introduction of Scripting

What is Bash

7
Permission Scripting

8
Basic Program Write

9
Basic Program Read

10
Basic Program Read

11
Script Execution

12
Arithmetic Operations

13
Important parameters of Command line

1. Ampersand Operator (&)


2. semi-colon Operator (;)
3. AND Operator (&&)
4. OR Operator (||)
5. NOT Operator (!)
6. AND – OR operator (&& – ||)
7. PIPE Operator (|)
8. Command Combination Operator {}
9. Precedence Operator ()
1) Ampersand Operator (&)
2) semi-colon Operator (;)
3. AND Operator (&&)
4. OR Operator (||)
5. NOT Operator (!)
6. AND – OR operator (&& – ||)
7. PIPE Operator (|)
8. Command Combination Operator {}

te@localhost:~$ [ -d bin ] || { echo Directory does not exist,


creating directory now.; mkdir bin; } && echo Directory exists.
9. Precedence Operator ()
9. Precedence Operator ()
References

https://ryanstutorials.net/bash-scripting-tutorial/
https://www.tecmint.com/chaining-operators-in-linux-with-practical-examples/

25

You might also like