11.1. Introduction

 <  Day Day Up  >  

With an interactive shell, the standard input, output, and error are tied to a terminal. When using the Korn ( ksh ) shell interactively, you type UNIX/Linux commands at the ksh prompt and wait for a response. The interactive Korn shell combined the best of the UNIX Bourne and C shells to provide you with a large assortment of built-in commands and command-line shortcuts, such as history, aliases, file and command completion, and so forth. David Korn expanded his shell to include a lot more, such as command-line editing with vi and emacs , new metacharacters, coprocessing, and error handling. The Korn shell is very popular and, although it started at AT&T, has been adapted to run on most operating systems.

This chapter focuses on how you interact with ksh at the command line and how to customize your working environment. You will learn how to take advantage of all shortcuts and built-in features in order to create an efficient and fun working environment. Chapter 12 takes you a step further. At that point, you will be ready to write ksh shell scripts to further tailor the working environment for yourself by automating everyday tasks and developing sophisticated scripts, and if you are an administrator, doing the same not only for yourself but also for whole groups of users.

11.1.1 Startup

Before the Korn shell displays a prompt, it is preceded by a number of processes. (See Figure 11.1.) The first process to run is called init , PID 1. It gets instructions from a file called inittab (System V) or spawns a getty (BSD) process. These processes open up the terminal ports, provide a place where input comes from ( stdin ) and the place where standard output ( stdout ) and standard error ( stderr ) go, and put a login prompt on your screen. The /bin/login program is then executed. The login program prompts you for a password, encrypts and verifies the password, sets up an initial environment, and starts up the login shell, /bin/ksh , the last entry in the passwd file. The ksh program looks for the system file, /etc/profile , and executes its commands. It then looks in the user 's home directory for an initialization file called .profile , and an environment file, conventionally called . kshrc . After executing commands from those files, the dollar sign prompt appears on your screen and the Korn shell awaits commands.

Figure 11.1. Starting the Korn shell.


 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net