Главная страница


ru.unix

 
 - RU.UNIX ----------------------------------------------------------------------
 From : Serge Matveev                        2:5020/52      27 Apr 2005  20:52:57
 To : Kirill Timofeev
 Subject : Re: error handler in shell script
 -------------------------------------------------------------------------------- 
 
 
  KT> В пеpле можно опpеделить функцию AUTOLOAD и тогда пpи вызове
  KT> неопpеделенной функции будет вызываться этот самый AUTOLOAD с
  KT> паpаметpами пеpвоначальной функции. Можно ли сделать так же на шелле? В
  KT> zsh есть тpап, котоpый обpабатывает ошибки (ZERR), но можно ли сделать
  KT> с его помощью пеpедачу паpаметpов я пока не понял.
 
 $ man sh
 
 trap [action signal ...]
        Cause the shell to parse and execute action when any of the speci-
        fied signals are received.  The signals are specified by signal
        number or as the name of the signal.  If signal is 0, the action
        is executed when the shell exits.  action may be null, which cause
        the specified signals to be ignored.  With action omitted or set
        to `-' the specified signals are set to their default action.
        When the shell forks off a subshell, it resets trapped (but not
        ignored) signals to the default action.  The trap command has no
        effect on signals that were ignored on entry to the shell.  trap
        without any arguments cause it to write a list of signals and
        their associated action to the standard output in a format that is
        suitable as an input to the shell that achieves the same trapping
        results.
 
        Examples:
 
              trap
 
        List trapped signals and their corresponding action
 
              trap '' INT QUIT tstp 30
 
        Ignore signals INT QUIT TSTP USR1
 
              trap date INT
 
        Print date upon receiving signal INT
     sh у меня - dash (The Debian Almquist Shell - a POSIX compliant shell).
 Так что должно работать.
         serge@matveev spb ru                       Serge Matveev & ...
         ICQ 3575357
 
 --- tin/1.7.8-20050315 ("Scalpay") (UNIX) (Linux/2.6.8-2-686 (i686))
  * Origin: После нас пришло новое поколение и выбрало Pepsi. (2:5020/52.0)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 error handler in shell script   Kirill Timofeev   26 Apr 2005 23:00:05 
 Re: error handler in shell script   Serge Matveev   27 Apr 2005 20:52:57 
 Re: error handler in shell script   Serge Matveev   28 Apr 2005 21:40:53 
 Re: error handler in shell script   Kirill Timofeev   28 Apr 2005 19:57:37 
 Re: error handler in shell script   Eugene B. Berdnikov   28 Apr 2005 00:08:28 
 Re: error handler in shell script   Kirill Timofeev   28 Apr 2005 20:01:55 
 Re: error handler in shell script   Eugene B. Berdnikov   29 Apr 2005 03:08:21 
Архивное /ru.unix/4270587d55ead.html, оценка 2 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional