Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet21/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   17   18   19   20   21   22   23   24   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

varname
to export the variable 
varname
.
The following script files are made available for users to edit. By editing one of these 
files, you can tailor your shell so that the definitions are available whenever you start a new 
session.
• 
.pro
file—Executes whenever the user logs in (no matter which shell is used).
• 
.bas
hrc—Executes whenever a new bash shell is started.
• 
.bash_profile
—Executes whenever the user logs in to a Bash shell.


The Bash Shell

59
If you only use Bash, you can put your definitions in .bashrc. This ensures that the defi-
nitions take effect whenever you start any new shell. If you start a shell of a different type, 
then the two bash files (.bashrc and .bash_profile) do not execute. However, there are other, 
similar, files for other shells. For instance, as .bashrc runs whenever a new Bash shell is 
started, .cshrc runs whenever a new C-shell (csh) is started.
Note that making changes to one of these files will not immediately impact your current 
session(s). These files are only read when you log in or start a new bash session. In order for 
you to force the changes to take effect, you can use the instruction 
source
on the given 
file, as in 
source ~/.bashrc
. This causes the interpreter to read the file, executing the 
statements therein.
2.5 OTHER SHELLS
Bash is only one shell available in Linux and Unix operating systems. Linux and Unix 
usually come with other shells that the user can select either from within a bash shell or 
the system administrator can specify as their default shell. Let us briefly compare the Bash 
shell to other shells.
The earliest shell was called the Thompson shell, introduced in 1971 in Unix. This was 
replaced in 1977 by the Bourne shell, again in Unix. Both shells were denoted by sh, the 
name of the program that would provide the shell environment and interpreter.
The primary features of the Bourne shell were that shell scripts (programs) could be run 
by name as if they were any other program in Unix. Programs run in a Bourne shell could 
be interactive or run in a batch processing mode. Redirection and pipes were made avail-
able. Variables were typeless, meaning that any variable could change the type of entity 
it stored at any time. Quotation marks were introduced for use in commands. Variables 
could be exported.
In addition, the Thompson shell defined a number of programming instructions sep-
arate from the Unix kernel for use in shell scripts. The Bourne shell defined additional 
instructions such as nested if–then–else constructs, a case (switch) statement, and a while 
loop. The syntax for the Bourne shell programming constructs was loosely based on Algol.
In the late 1970s, Bill Joy wrote a new Unix shell that he called C shell (csh). The main 
differences between the Bourne shell and the C shell are that the syntax is largely based 
on the C programming language and the C shell contains a number of useful editing and 
shortcut features. In fact, because of the utility of these features, they have been incorpo-
rated into many shells since C shell. Among the editing and shortcut features introduced 
in C shell were:
• History
• Command line editing
• Aliases
• Directory stack (we visit this in Chapter 3)


60

Linux with Operating System Concepts
• Tilde completion
• Escape completion (in Bash, it is tab completion)
• Job control (covered in Chapter 4)
A variation of the C shell was created between 1975 and 1983, known as TC shell (tcsh) 
where the ‘T’ indicates the TENEX operating system. The TC shell, or the T shell for short, 
added greater operability to accessing commands in the history. Table 2.7 shows the varia-
tions made available in TC shell.
The KornShell (ksh) was developed by David Korn of Bell Labs and released in 1983. It 
shares many of the same features as C Shell but includes WYSIWYG style command line 
editing features, unlike the emacs-style command line features of Bash, C shell, and TC 
shell. It also includes floating point variables and operators.
The next shell released was the Almquist shell, known as ash. This was released in 
1989. It is a variation of the Bourne shell written for computers with modest resources 
because it was smaller and faster than the Bourne shell. Later versions began to incorpo-
rate features found in C shell such as command line editing and history. The ash shell has 
largely been replaced by dash, a newer version available in Debian Linux, or discarded 
altogether.
In 1989, Brian Fox released the Bourne Again Shell (Bash) for the GNU project. As we 
have already explored the Bash shell through this chapter, we will not go over the details 
here. However, as you have seen, it shares many features with C Shell and TC Shell.
Finally, in 1990, the Z shell (zsh) was released as an extension of both the Bourne shell 
and the Korn shell. In addition to the features obtained from the previous shells, it adds 
spelling correction, customizable prompts, and modules that directly support both net-
working and mathematical computations. In addition, some shells have adopted previous 
shells and added features to support specific programming languages, whether they be Java 
(Rhino, BeanShell), Perl (psh), SQL (sqsh), or Scheme (scsh).
Most users today will either use a variation of Bourne/Bash or C Shell (often TC shell). 
So here, we conclude with a comparison between TC Shell and Bash. The differences, rel-
evant to the discussion of this chapter, are illustrated in Table 2.8. If features are not listed 
TABLE 2.7 
TC Shell History Commands

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   17   18   19   20   21   22   23   24   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish