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


ru.linux

 
 - RU.LINUX ---------------------------------------------------------------------
 From : Valentin Nechayev                    2:5020/400     02 Jun 2003  07:36:52
 To : Maxim Razin
 Subject : Re: [[b]a]sh, '$@' без кавычек --  признак ошибки
 -------------------------------------------------------------------------------- 
 
 
 >>> Maxim Razin wrote:
 
  VN>> Опять-таки, это причина ставить кавычки, но не дописывать 'x' 
  VN>> спереди.
 MR> Hо даже это не всегда помогает, по крайней мере, с bash.  Результат
 MR> эксперимента:
 
 MR> ~$ touch "="
 
 MR> Пробуем test, встроенный в bash
 
 [...]
 
 Посмотрел в SUSv3. Отмазались, гады:
 
 === cut ===
 
      In the following list, $1, $2, $3, and $4 represent the arguments
      presented to test:
    0 arguments:
           Exit false (1).
    1 argument:
           Exit true (0) if $1 is not null; otherwise, exit false.
    2 arguments:
           + If $1 is '!' , exit true if $2 is null, false if $2 is not
             null.
           + If $1 is a unary primary, exit true if the unary test is
             true, false if the unary test is false.
           + Otherwise, produce unspecified results.
    3 arguments:
           + If $2 is a binary primary, perform the binary test of $1 and
             $3.
           + If $1 is '!' , negate the two-argument test of $2 and $3.
           + If $1 is '(' and $3 is ')' , perform the unary test of $2.
           + Otherwise, produce unspecified results.
    4 arguments:
           + If $1 is '!' , negate the three-argument test of $2, $3, and
             $4.
           + [XSI] [Option Start] If $1 is '(' and $4 is ')' , perform the
             two-argument test of $2 and $3. [Option End]
           + Otherwise, the results are unspecified.
 
    >4 arguments:
 
           The results are unspecified.
           [XSI] [Option Start] On XSI-conformant systems, combinations of
           primaries and operators shall be evaluated using the precedence
           and associativity rules described previously. In addition, the
           string comparison binary primaries '=' and "!=" shall have a
           higher precedence than any unary primary. [Option End]
 
 === end cut ===
 
 Сплошное "The results are unspecified" - мол, %{любитесь} сами.
 
 Во FreeBSD'шном мане чуть вежливее:
 
 GRAMMAR AMBIGUITY
      The test grammar is inherently ambiguous.  In order to assure a degree of
      consistency, the cases described in the IEEE Std 1003.2 (``POSIX.2''),
      section D11.2/4.62.4, standard are evaluated consistently according to
      the rules specified in the standards document.  All other cases are sub-
      ject to the ambiguity in the command semantics.
 
 MR> Воистину искусственный интеллект давить :)
 
 Что толку? Ритчи и Томпсону - выговор с занесением - вот это ближе к телу.
 -netch-
 --- ifmail v.2.15dev5
  * Origin: Dark side of coredump (2:5020/400)
 
 

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

 Тема:    Автор:    Дата:  
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Aleksey Cheusov   31 May 2003 20:49:29 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Valentin Nechayev   01 Jun 2003 10:47:36 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Maxim Razin   01 Jun 2003 12:37:38 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Valentin Nechayev   01 Jun 2003 20:09:11 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Valentin Nechayev   02 Jun 2003 07:36:52 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Maxim Razin   02 Jun 2003 08:56:14 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Valentin Nechayev   02 Jun 2003 10:59:32 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Maxim Razin   02 Jun 2003 22:55:38 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Aleksey Cheusov   03 Jun 2003 13:44:01 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Valentin Nechayev   03 Jun 2003 18:48:23 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Eugene B. Berdnikov   04 Jun 2003 17:03:09 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Andy Shevchenko   02 Jun 2003 21:10:46 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Michael de\'OZ   04 Jun 2003 18:57:24 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Aleksey Cheusov   02 Jun 2003 14:58:47 
 Re: [[b]a]sh, \'$@\' без кавычек -- признак ошибки   Valentin Nechayev   02 Jun 2003 15:11:03 
Архивное /ru.linux/7368a7d2afda.html, оценка 2 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional