Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.5.html
Дата изменения: Fri Jan 17 12:43:20 1997 Дата индексирования: Tue Oct 2 01:02:37 2012 Кодировка: Поисковые слова: solar corona |
The exit statement will exit the current shell script. It can be given a numeric argument which is the script's exit status. If omitted the exit status of the last run command is used. 0 (zero) signifies success, non-zero signifies failure. For example:
#!/bin/sh if [ $# -ne 2 ] # "$#" is number of parameters- here we test # whether it is not equal to two then echo "Usage $0 \<file1\> \<file2\>" # not two parameters # so print message exit 2 # and fail ($0 is # name of command). fi ...<rest of script>
This script is supposed to take two positional arguments. It will exit with status 2 (error) rather than 0 (success) if it is not called with two parameters.