Unix and Shell Programming Anoop Chaturvedi BL Rai Instant Download
Unix and Shell Programming Anoop Chaturvedi BL Rai Instant Download
Rai download
https://ebookbell.com/product/unix-and-shell-programming-anoop-
chaturvedi-bl-rai-6719026
https://ebookbell.com/product/unix-and-shell-programming-1st-edition-
harwani-b-m-5673262
https://ebookbell.com/product/introduction-to-unix-and-shell-
programming-1st-edition-m-g-venkateshmurthy-32722142
https://ebookbell.com/product/shell-programming-in-unix-linux-and-
os-x-4th-edition-stephen-g-kochan-5731674
https://ebookbell.com/product/shell-programming-in-unix-linux-and-
os-x-4th-edition-patrick-wood-5903540
Unix Programming Unix Processes Memory Management Process
Communication Networking And Shell Scripting Dr Vineeta Khemchandani
https://ebookbell.com/product/unix-programming-unix-processes-memory-
management-process-communication-networking-and-shell-scripting-dr-
vineeta-khemchandani-43688982
Mastering Unix Shell Scripting Bash Bourne And Korn Shell Scripting
For Programmers System Administrators And Unix Gurus Second Edition
2nd Edition Randal K Michael
https://ebookbell.com/product/mastering-unix-shell-scripting-bash-
bourne-and-korn-shell-scripting-for-programmers-system-administrators-
and-unix-gurus-second-edition-2nd-edition-randal-k-michael-2245602
Learning Unix For Os X Going Deep With The Terminal And Shell 2nd
Edition Dave Taylor
https://ebookbell.com/product/learning-unix-for-os-x-going-deep-with-
the-terminal-and-shell-2nd-edition-dave-taylor-5312240
Command Line Fundamentals Learn To Use The Unix Commandline Tools And
Bash Shell Scripting Vivek N
https://ebookbell.com/product/command-line-fundamentals-learn-to-use-
the-unix-commandline-tools-and-bash-shell-scripting-vivek-n-49184084
Wicked Cool Shell Scripts 2nd Edition 101 Scripts For Linux Os X And
Unix Systems 2nd Edition Taylor
https://ebookbell.com/product/wicked-cool-shell-scripts-2nd-
edition-101-scripts-for-linux-os-x-and-unix-systems-2nd-edition-
taylor-54882772
UNIX AND SHELL
PROGRAMMING
By
Acknowledgement (xii)
— A u th o rs
Chapter 1
INTRODUCTION TO UNIX
1.1 DEVELOPMENT OF UNIX
UNICS (Uniplexed Information and Computing System) 1970. And then UNIX—1973 in ‘C’.
1.1.1 “Bill Joy” (AT&T Bell Laboratory) is a Student Who Wrote Vi Editor
Microsoft was the first to run UNIX on a PC with 640 KB of memory. They called their
product XENIX that was bared on earlier edition of AT&T. But with some BSD borrowed utilities.
XENIX was later sold off to SCO (The Santa, cruz operation) who today markets the most popular
commercial brand of UNIX for the desktop—SCO UNIX. It now offers two major flavors—SCO
open server release 5 and SCO UNIX ware 7: the later is SVR 4—compliant,
Shell
Uni
x
Com
er man
Oth lication ds
App tem SW User
User Sys Kernel Shell
Shell
s
H/W
er
pil
Da
m
Pa ta ba
Co
cka se
ge
Internet
Tools
Shell
Shell
Us
Us er
er
Fig. 1.1
2 U NIX AND S HELL P ROGRAMMING
User
(i) Ordinary user → Work only their own working directory.
(ii) Super user → Super user have the command on entire system. They can add user.
Remove user etc.
1.2.1 The Reasons for Popularity and Success of the UNIX System
(i) The system is written in high level language, making it easy to read, understand
change and move to other machines.
I NTRODUCTION TO U NIX 3
(ii) It has a simple user interface that has the power to provide the services that users want.
(iii) It provides primitives that permits complex programs to be built from simpler
programs.
(iv) It user a hierarchical file system that allows easy maintenance and efficient
implementation.
(v) It uses consistent format for files, the byte stream, making application programs easier
to write.
(vi) It provides a simple, consistent interface to peripheral devices.
(vii) Its a multiuser, multiprocess system. Each user can execute several process
simultaneously.
(viii) It hides the m/c architecture from the user, making it easier to write programs that run
on different h/w implementations.
1. Multiuser System
In a multiuser system, the same computer resources–hard disk, memory etc., are accessible
to many users. The users don’t flock together at the same computer but are given different terminal
to operate from. All terminals are connected to the main computer whose resources are available
by all users. The following figure shows a typical UNIX setup.
Terminal Terminal
Host M/c
Terminal Terminal
Fig. 1.2
4 U NIX AND S HELL P ROGRAMMING
Host M/C also known as server or a console. The number of terminal connected to the Host
M/C depends on the number of ports that are present in its controller card. There are several type
of terminal that can be attached to host M/C.
(i) Dumb Terminal—These terminal consist of a keyboard and a display unit with no
memory or disk of its own. These can never act as independent machine.
(ii) Terminal Emulation—A PC has its own microprocessor, memory and disk driver. By
attaching this to host M/C through a cable and running a S/W from this PC. We can
emulate it to work as if it is a dumb terminal. At such times the memory and disk are
not in use and the PC can’t carry out any processing its own. The S/W that makes the
PC work like a dumb terminal is called terminal emulation S/W. VTERM and XTALK
are two such popular S/W.
(iii) Dial-In-Terminal—These terminal used telephones lines to connect with host M/C. To
communicate over telephone lines we attach a modem.
Modem
Fig. 1.3
2. Multitasking Capabilities
Its capable of carrying out that a single user can run more than one job at the same time.
In UNIX this is done by running one job normally and other job in background. This is managed
by dividing the CPU time b/w all processes.
“The multitasking provide by MS-DOS is known as serial multitasking”.
3. Communication
The communication may be within the n/w of a single main computer or between two or
more such computer n/w. The users can easily exchange mail, data, programs through such
n/w. Distance poses no barrier to passing information or message to and from.
4. Security
UNIX has three inherent provision for protecting data.
(i) By assigning passwords and login names to individual users ensuring that not any-
body can come and have access to your work.
(ii) At the file level there are read, write, and execute permissions to each file decide who
can access a particular file.
(iii) File encryption.
I NTRODUCTION TO U NIX 5
5. Portability
It can be ported to almost any computer system with only the bare minimum of adaptations
to suit the given computer architecture.
date eat who ask rdsk passud Anoap Unix bin kumar sharma
Fig. 1.4
In UNIX everything is treated as file. Its still necessary to divide there files into three
categories:
(i) Ordinary files—Contains only data. This includes all data, source programs, object
and executable code all UNIX commands as well as any files created by the user. The
most common type or ordinary file is the text file.
(ii) Directory files—A directory contains no external data but keeps some details of the
files and sub-directories that it contains. A directory file contains two field for each file.
The name of the file and its identification number.
(iii) Device files—Consider physical device as files. This definition includes printers, tapes,
floppy driver, CD-ROMs, hard disk and terminal.
2.1.1 Differences
(i) Process in user mode can access their own instructions and data but not Kernel
instructions and data. Process in Kernel mode however can access Kernel and user
addresses. For example, the virtual address space of a process may be divided b/w
8 UNIX AND S HELL P ROGRAMMING
addresses that are accessible only in Kernel mode and addresses that are accessible in
either mode.
(ii) Some m/c instructions are privileged and result in an error when executed in user
mode. For example a m/c may contain an instruction that manipulates the processor
status register. Process executed in user mode should not have this capabilities.
Although the system executes in one of two modes, the Kernel runs on behalf of a user
process. The Kernel is not a seperate set of processes that run in parallel to user-process but its
part of each user process.
3 Interrupt Disk
CPU
controller Controller
4 2
1
Fig. 2.1
Steps in starting an I/O devices and getting interrupt.
In step 1. The driver tells the controller what to do by writing into its device Register. The
controller then starts the device. When the controller has finished reading or writing the number
of bytes it has been told to transfer, it signals the interrupt controller chip using certain bus lines
in step 2.
If the interrupt controller is prepare to accept the interrupt it assert a pin on CPU chip
informing it, in step 3.
In step 4. The interrupt controller puts the number of the device on the bus so the CPU can
read it and know which device has just finished.
Current Instruction
Interrupt processing involves taking
Next Instruction the interrupt, running, the interrupt
3 Return handler, and returning to the user
1 Interrupt program.
2 Dispatch
to handler
O PERATING S YSTEM S ERVICES 9
Exception
An exception condition refers to unexpected events caused by a process such as addressing
illegal memory, executing privileged instructions, dividing by zero and soon. OR “Exception are
run time error”.
Difference
Exception Interrupt
M/C Errors
Clock
Higher Priority
Disk
N/W Devices
S/W Interrupts
Interrupt Level
Fig. 2.2
Memory Management
The Kernel permanently resides in main memory as does the currently executing process.
User Programs
Trap Libraries
User Level
Kernel Level
Inter-process
Process
Communication
Control
File Subsystem
Schedular
Subsystem
Memory
Management
Buffer Cache
Character Block
Device Drivers
Hardware Control
Kernel Level
H/W Level
Hardware
Trap
A trap (or exception) is a S.W. generated interrupt caused either by an error (for example,
division by zero or invalid memory access) or by a specific request from a user program that an
0.5 service be performed.
File Subsystem
The file subsystem manages files, allocating file space administering free space controlling
access to files and retrieving data for users. Process interact with the file subsystem via a specific
set of system calls such as open, read, write, shown, stat, chmod etc.
2.3.2 Buffer
The file subsystem accesses file data using a buffering mechanism that regulates data flow
b/w the Kernel and secondary storage devices. The buffering mechanism interacts with block
I/O device drivers to initiate data transfer to and from and Kernel Block I/O device are random
access storage device to the rest of the system. It also interacts directly with raw I/O devices
(character device that are not block device) without the intervention of buffering mechanism.
O PERATING S YSTEM S ERVICES 11
Chapter 3
FILE SYSTEM
After the disk has been partitioned its still not ready for use. A file system has to be created
in each partition. There usually are multiple file systems in one m/c each one having its own
directory tree headed by root.
Every file system is organized in a sequence of blocks of 512 bytes each. (1024 in Linux) and
will have there four components:
3. Inodes—Since the block of a file are scattered throughout the disk, its obvious that
the addresses of all its blocks have to be stored and not just the starting and ending
ones. These address are available in the term of link list in the inode a table main-
tained individually for each file. All inode are stored in inode blocks distinctly
separate from the data block and are arranged contiguously in a user in accessible
area of file system.
Abdominal wounds, 98
Abella, 157
Abulcasis, 35, 78
Abul Farag, 33
Adalbert of Mainz, 63
Adale, 41
Ægidius, 64
Ægina, Paul of, 6, 27, 33, 138, 146, 149, 184, 186
Aëtius, 27
Alcohol, 194
Alessandra Giliani, 164
Alexandria, 33
Ali Abbas, 35
Alphanus, 41
Anselm of Havelberg, 63
Anthemios, 5
Arabian culture, 8
surgeons, 149
Arabians, 139
Arabs, 46
Archbishop of Lyons, 63
Aretæus, 186
Arnold de Villanova, 66
aphorisms of, 67
Asylums, 191
Aurelius Celsus, 26
Autointoxication, 83
Avenzoar, 35, 77
Averroes, 35
Baas, 181
Bachtischua, 7
Bacon, Roger, 14, 110
Bartholomæus Anglicus, 81
Basil Valentine, 84
Baths, 32
for melancholia, 184
Bedlam, 188
Bedlamites, 201
Bernard of Morlaix, 49
Bladders of animals, 78
Bleeding, 55, 84
Blood-letting, 32
Bologna, 40
Bougies, 123
Branca, 106
Antonio, 107
Bruno da Longoburgo, 96
Bubonic plague, 77
Calomel, 85
Cassiodorus, 25
Cataract, 151
Celsus, Aurelius, 26
Chauliac, Guy de, 11, 66, 71, 72, 105, 109, 118, 123,
139, 140, 153, 167
Christian hospitals, 24
Cleanliness, 95
Cold compresses, 30
Compilation, 3
Constantine, 36, 45
Contrecoup, 92
Cosmetics, 77
Dentistry, 138
Depressed fractures, 93
Diet, 31, 36
for melancholies, 185
Dioscorides, 26
Dioscoros, 5
Drainage, 97
tubes, 125
Duke, Robert, 46
Elias, 41
Elinus, 41
Epileptic conditions, 30
Exorcism, 195
Fever, 32
Filaria medinensis, 77
Fistulæ, 100
Fistulas, 127
Frederick II., 42
law of, 43, 206
Gariopontus, 41
Gilbert, 69
Gonorrhœa, 123
Guido of Montpellier, 64
Gurlt, 9, 47, 69, 90, 93, 95, 96, 99, 106, 110, 113,
121, 146, 156
Hæmoptysis, 30
Hangman’s rope, 28
Hare-lip, 134
Headache, 30
Hemicrania, 30
Herbs, 26
Hernia, 68
operations too frequent, 122
radical cure of, 121
reduction of, 122
Hernias, 99
Herodotus, 137
Hippocrates, 26, 47
Hospital, 64, 65
at Lübeck, 178
for lunatics, 187
of Bedlam, 188
of Belisarius, 171
of Fabiola, 171
of Pope Symmachus, 171
of St. Basil, 170
of St. Jean, 178
of Tonnerre, 176
Hospitals, 169
Christian, 24
for lepers, 181
of the Holy Ghost, 172
royal, 174
“Hudibras,” 107
Humours, 54
Hymns, Latin, 48
Hysteria, 34
Infirmaries in monasteries, 24
Inhalations, steam, 29
Insanity, 194
lash for, 198
John of Salisbury, 64
of Gaddesden, 70, 119
Latin hymns, 48
Law as to fee, 44
of Frederick II., 43, 206
Ligatures, 125
“Lilium Medicinæ,” 73
Magnetism, 15
Maimonides, 35, 79
Medical oath, 44
schools at universities, 74
superstitions, 22
Medici, 164
Mercuriade, 157
Mesue, 47
Methrodoros, 5
Metrorrhagia, 33
Milk, 29, 52
bath, 78
Monte Cassino, 39
Moorish physicians, 62
Morley, Henry, 17
Morgagni, 84
Muratori, 76
Nature study, 13
Nefretykes, 85
Nervous system, 30
Nicaise, 166
Nose, surgery of the, 106
Number of bones, 54
of veins, 54
Oath, medical, 44
Ophthalmology, 151
Opium, 29
Ordronaux, 47, 50
Oribasius, 28
Orthodontia, 139
Pammachius, 171
Physicians, Moorish, 62
Plague, bubonic, 77
Pontus, 41
Popular medicine, 22
Psycho-analysis, 196
Pus, 103
Puschmann, 56
Putrefaction, 97
Rectal feeding, 78
surgery, 127
Regimen, 48, 49
sanitatis, 47
Renal disease, 85
Rolando, 91
“Rosa Anglica,” 70
St. Benedict, 24
St. Bernard, 63
of Clairvaux, 161
Saintsbury, Professor, 48
School of Salerno, 57
Scotus, Duns, 40
Smallpox, 35, 70
Snake, skin of, 28
Sore throat, 31
Steam inhalations, 29
Students, 65
Superstitions, medical, 22
Syphilis, 123
arsenic treatment of, 124
Tagliacozzi, 107
Temperaments, 54
Temperance in surgeons, 97
Tetanus, 130
Textbooks, medieval, 88
Therapeutics, 23
Thyroid gland, 28
Tooth-powder, 140
Trallianus, 4
Trephining, 93, 94
Trichiasis, 153
Trotula, 155
Valentine, Basil, 84
Valesco de Taranta, 71
Wood-hound, 193
Wounds, abdominal, 98
dry treatment of, 125
of intestines, 99
treatment of, 98
ebookbell.com