Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unix Advanced Shells Chapter 10. Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses,

Similar presentations


Presentation on theme: "Unix Advanced Shells Chapter 10. Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses,"— Presentation transcript:

1 Unix Advanced Shells Chapter 10

2 Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses, interprets, finds and executes the commands you type –similar to Windows “Command Prompt”, but more sophisticated and more user friendly u A High-Level Programming Language –shell script is a program contains a series of commands –you can let the system perform those commands by typing the file name of the script –similar to.BAT batch files under MS-DOS, but again much more sophisticated

3 Shells vs. Graphical User Interfaces (GUIs) u GUIs are more friendly to beginners –lead you by the hand –“point and click” interface requires little experience u Shells are often better for experienced users –shells tend to be faster, more efficient, and flexible v fewer steps to do things v do not need to change input devices (keyboard vs. mouse and keyboard) –but, you must know command names and syntax u Most modern Unix systems offer both a GUI and a Shell interface

4 Unix Shells u Many shells to choose from... u sh: The Bourne Shell –the original Unix shell –S.R. Bourne designed it at Bell Labs –not very "user friendly”, but good for programming –sh or a reasonable facsimile comes packaged with virtually every Unix system u csh: The C-shell –a shell whose syntax is more “C”-like –command history and job control v make it very popular as a CLI –comes with most Unix systems

5 Unix Shells u tcsh: The T C-Shell –updated C-shell with better “line-editing”, access to command history, and command and file name completion –default shell on GAUL u bash: The Bourne Again Shell –aimed at providing a public domain version of the Bourne shell –default shell for Linux –implemented as a part of GNU project by public efforts u ksh, zsh, tsh,...

6 Changing Your Shell u Default shell is the shell you are given after you login to the system u Changing your shell... –Your default shell can be changed using the “chsh” command on Unix. v More on this later –By typing “sh”, “csh”, “tcsh”, “bash”, etc. v Run another type of shell as a “subshell” v After you exit from the subshell, you will come back to the old one v Your default shell is unchanged

7 Which Shell(s) Do We Teach? u For the CLI aspects of the shell, we teach tcsh u For programming language aspects, we teach sh u Many Unix users use shells in this way u Many features of sh or tcsh are shared by other shells –e.g. tcsh is really an extension of csh, with some extra features

8 Issuing Commands u Unix shells issues a prompt for input u A typical prompt looks like: u Editing input: –using arrow keys to move the cursor –using BackSpace or DEL or Ctrl-H to erase a letter –using Ctrl-U to erase the whole line. terra[1]> Machine name Separator History number

9 Issuing Commands u A command is typically a program saved in the Unix file system, or part of the shell. –type the name of the program, press –shell searches for the program and runs it u Most commands take arguments –Operands: file names, numbers, etc. terra[2] > cat myfile terra[3] > expr 1 + 3 –Options: immediately following a ‘-’ or ‘+’ terra[4] > cat -n myfile terra[5] > ls -al display file "myfile" with line numbers

10 Exercise u Use ps to see which shell you are using. u Change your shell to another by sh, csh, or tcsh u Use ps again to see how many shells are running; explain why.


Download ppt "Unix Advanced Shells Chapter 10. Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses,"

Similar presentations


Ads by Google