|
|
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) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор Архивное /ru.linux/7368a7d2afda.html, оценка из 5, голосов 10
|