1 / 12

UNIX chapter 04 UNIX Shells

UNIX chapter 04 UNIX Shells. Mr. Mohammad Smirat. Introduction. The shell is the software that listens to commands typed in at the terminal and translates them into instructions in the system’s internal syntax.

ember
Download Presentation

UNIX chapter 04 UNIX Shells

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UNIX chapter 04UNIX Shells Mr. Mohammad Smirat

  2. Introduction • The shell is the software that listens to commands typed in at the terminal and translates them into instructions in the system’s internal syntax. • It is a command interpreter that can expand and change the command- according to built in rules- before it is executed. • When shell start running, it gives you a prompt and waits for your command. It is known as UNIX command interpreter.

  3. Commands Types • The shell interpret your command by looking at the first word as the command itself, any subsequent word starting with hyphen is an option for that command, the rest of the command will be the arguments of the command. • UNIX commands are two types, the first are the internal commands which are parts of the shell itself. The second are the external commands which are stored in executable files or shell scripts.

  4. Commands Types (cont …) • Internal commands code is exist in the shell itself. So when an internal command is used, the shell only go to the command code and execute it. • To execute an external command, the shell searched several directories looking for a file that has the name of the command. It then assume that the file contains the code to be executed and runs the code. • Names of the directories that a shell searches to fined the file corresponding to an external command are stored in the shell variable PATH.

  5. Shells

  6. Ways to change your Shell • The command echo $SHELL will display your default shell on your system. • To change it temporally and switch to another shell you can simply write the desired shell name and press enter. This will run the new shell on top of the running shell. • To change your default shell use the command chsh as follows. Mohammad> chsh Old shell: /bin/tcsh New shell: /bin/sh Hashed database not in use, only /etc/passwd text file updated.

  7. Environment Variable • UNIX system has a hidden file that usually named .profile in system V and .login in system BSD. This file contain the initial settings of important environment variables for the shell and other utilities. • The actions of each shell are affected by the setting of certain variables • ENV, the path along which UNIX looking to find configuration files. • HOME, the name of user’s home directory. • MAIL, the name of the system mail box. • PATH, the directories that shells searches to find a command or program. • PWD, current working directory.

  8. Shell Start-up Files and Environment Variables

  9. Shell Metacharacters • These are the characters other than letters and digits that have special meaning to the shell. • They cannot be used in file names. • Allow you to specify multiple files in multiple directories in one command line.

  10. Examples of Shell Metacharacters • lpr -Pspr [0-9][a-zA-Z].html • ls lab[0-9]??.c

More Related