Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
1_eng_format.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
59.9 Кб
Скачать

STATE SERVICE FOR SPECIAL COMMUNICATION AND INFORMATION SECURITY OF UKRAINE

ADMINISTRATION OF STATE SERVICE FOR SPECIAL COMMUNICATION AND INFORMATION SECURITY OF UKRAINE

Odessa National Academy of Telecommunications named O.S. Popov

Chair of Telecommunication Networks

Nikitchenko V.V., Krasovsky M.L., Yavorskaya O.M.

NETWORK OPERATING SYSTEMS

Teaching Aid

for training bachelors

in Telecommunication

Odessa, 2012

Laboratory work № 1

Command Interpreter csh

1. Goal of work

    1. To get acquainted with command interpreter for Unix system.

    2. To get skills of practical work with interpreter csh

2 Key Positions

2.1 Common knowns

Even if you operate UNIX system with help of X-Window graphical interface, still you will need to deal with command interpreter. It gives flexibility, that is necessary for solving the most difficult problems, but requires certain experience at the same time. As known, interpreter is a command-line interface, that is very different from graphical environments like Windows or Mac OS. Sometimes interpreter is called shell. This term is used in UNIX systems for description of different operation system work levels, in architecture of which such functions are defined: internal, automated and external that are run by user. Providing of safe and structured access to the kerrel is one of the interpreter tasks. It perceives user`s commands and with the help of system core functions converts it into the processes, that works with files and devises. It prevents execution of unreliable code that can cause core failure and also makes searching and programs running in system easier.

In practical sence interpreter is a program that can cause new processes. It runs with a system during every registration in it, displays command-line invitation, executes user commands and finishes its work after the exit from the system.

2.2 Command Interpreter csh

Csh command is a command language`s interpreter .It starts with execution of command from .cshrc file in home catalog of user which caused it. If it is interpreter of log in, it also executes commands from .login file. In the case of normal functioning, shell interpreter begins command reading from terminals and outputs % sign as invitation. Then command interpreter numerous times executes next operations: reading of logging in row and output it in words. Sequence that was received from words inserts in command prehistory list and then is analyzed syntactically. After this, at last, every command from current row is executed. When interpreter shell of log in completes its execution, it executes commands from .logout file from input user catalog.

Interpreter separates input rows on words, considering that they separates from each other with spaces and tabulation signs, taking into account next exceptions. Symbols &, |, ;, <, >, (, ) form separate words. Separate words form such pairs of double symbols as &&, ||, << or >>. Such methasymbols of syntactic analyzer can be the part of other words or their special task can be cancelled by previous symbol \. Sign of new row with symbol \ is equivalent to space.

Moreover, rows that enclosed in pairs of quotes:`, ‘, or “ forms parts of word; methasymbols in such rows that include spaces and tabulation signs doesn`t form separate words. Inside pairs that consist of symbols \ or “, sign of new row with a priori sign \ represents really symbol of new row.

When input data for interpreter inputs not from the terminal, symbol # points that comments that continue until the end of input row are situated in the row. This symbol has no special task if it has a priori sign \ and if it is situated inside the quotes `, ‘, or “.

Command Line

Interpreter when he receives command line, executes some changes with it, namely:

-reveals alias;

-reveals methasymbols (*, ?, [, ], ~, {, });

-substitutes variables shell;

-executes command if it is built-in command of interpreter or starts process if command is external.

Lets analyze operations on stages.

Alias. Built-in command alias allows to define commands` alias. Example:

# alias mycat ‘cat | more’

Defines mycat as alias of line cat | more . That`s why you can use command mycat further and it will be revealed by interpreter everywhere you will use it. This is the way of defining of short names for long multiple commands.

Built-in command unalias mycat destroys alias mycat that was known earlier.

Methasymbols. Methasymbols allows to write shortly entire lists of words (mostly file names). Csh considers word that includes methsymbols as a template for making a list of file names:

  • in template it replaces any sequence of symbols. For example m* will reveal in list of all files that begin from letter m. There exist small exception from this rule: just * lowers in list suchfiles that have names beginning with point;

  • ? replaces one of the symbols. For example m? will rexeal in the list of all file names that begins with m and consists only two leters;

  • [.-.] allows to show interval for substituting symbol. For example m[a-e] will be revealed in ma mb mc me;

  • {…,…} allows to list words for substitution. For example m{red,blue,green} will be revealed in mred mblue mgreen;

  • At last tilde allows to show home catalog of user:

~name/ is equivalent to directory of full path in home catalog of user name (For example,/usrl/name/);

~/ is equivalent to directory of full path in your own home catalog.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]