(c) Larry Ewing, Simon Budig, Garrett LeSage
� 1994 �.

������� ����������� � ��������������� �����������

������ | ����� | � ������� | ��������� ��������� | ����������� ��� | �������� ���/AMICT
���������� | ���������� | ������� ������� | ������-��������� | �������� � ��������� ������
�������������� ������� | ���������� | ����� �������� | ���������� ����������

���� ������

�������� ������ �������� � ���������� ��������� �� ����� shell. ��������� �������� � ����������� � ����������� ��������� ������; ������������ ��������� ���������, ������; ��������� �������� ������� � ������� ������� test. ������� ��������� �������, ������������ ���������� Posix.2 � ����������� �����������:

read declare (-i) test [ if select while for

�������� ������

��������! ������ �������� ���������� �������� �����������, ��������������� �������������, ������� �� ������ ���������� ��������� ���������. � ������ ������� �������� ������ ���� ���������� �� ������, ���������� � ���� �������� ��������.

��������! ���� �������� ���������� ������� �����������.

��� 1 (�������).
��������� ���������� ����������� man � ������� ������� pdf ������� ����� ���������� � ��������� ������ � ����������, ������������� � ������� "���� ������".

��� 2 (����������).
2.1 �������� �������� read_var.sh, ������� � ������� ������� read ����������� �������� ���������� ab � ��������� ����� ���������� �������� �� �����.
2.2 ��������� ��������� ���������� ������� echo $ab
2.3 ��������� ��������������� ������������ ������ ��� read_var.sh �������� �������� ��������� ab � ���� vars.txt.
2.4 � ������� declare ���������� ���������� int_var ������ ����. ������� �������� ���������� � ������� ������� read. ����� �������� ����� �������� � ���������� int_var ���� ������: �) ����� �����; �) ������; �) ������������ ����� (�������� 3.14)?

��� 3 (��������� ��������� ������).
3.1 �������� �������� print_args.sh, ������� ������� ���������� � ������ ���������� ��������� ������ � ������� ����������� ���������� ${#}${*}, ${@} ��������������. ������ �� ��� ������������ ������� � ������ ${*}, ${@}? �������� ���������� ���������� ���������� � ������� ${#} � ������������ ��������� argc ������� main ����� �� (��� 1 �����).
3.2 �������� � print_args.sh ����� ����������� ���������� � ������� 01. ����� ��������� ����� � ������ ������� ������� ��� ����������?

��� 4 (����������� �����������, ��. ������� 7.16, 7.18, 7.21 � ��. ���. pdf ).
4.1 ��������� �������� if � ������� test �������� �������� root_test.sh, ����������� � �������� ��������� ��������� ������ ��� ��������������� ������������. ���� �������� �� �����, �� ������� "����������� ���". ���� �������� ������ � ��������� �� ������� "root", �� ������� "�� - �����������������", ����� ������� "�� - ������� ������������".
4.2 ��������� �������� select �������� �������� poll_menu.sh ������������ ���� ��� ����������� �� ���� �� ������:

  1. �����
  2. ����
  3. �����
  4. ���
  5. ����
  6. ���
4.3 ��������� ����� ������� 7.21 �������� �������� for_args.sh ��� ������ � ������ ������� ����������� ����������. �������� �������� while ���������� for.

�������� ������ ������

�� ������� ����� �������� 8 ������. ��� ���� ������� ������ ���� ��������� ���������, ��������� � ����, ����� ������ �������� ����������� ������� � ����� ��������� ���� �������� �������: �������, ������, ������.

������� ������, �� ������ ������������������ 1) ������ �������� �� ���������� �������� (man, whatis, apropos, info); 2) ������ ������ ���������� ����������� � ������� "���� ������" ������ (��������, echo — ����� ������ ������); 3) ������ ���������, ��������� �������� shell; 4) ������ ��������������� � ������ ����������� ��������.