[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: как искать то что тебе нужно про bash в процессе изучения



On 2013-08-22, Artem Chuprina wrote:

> Вообще-то оно не из man bash, а из man test.  Потому что [ - это команда
> такая, /usr/bin/[, она же /usr/bin/test.
>
Что бы быть точным: bash(1)

  SHELL BUILTIN COMMANDS
       test expr
       [ expr ]
              Return a status of 0 or 1 depending on the evaluation of the
              conditional expression expr. Expressions are composed of the
              primaries described above under CONDITIONAL EXPRESSIONS.


Если хочится системную - то:

  command test ...

В "CONDITIONAL EXPRESSIONS" есть замечания по типу:

       string1 = string2
              True if the strings are equal.  = should be used with the test
              command for POSIX conformance.

как сделать так что бы built-in следовало POSIX. Или (ключевое слово "posix mode"):

  bash --posix
  sh
  set -o posix

Вообще же лучше пользоваться [[ ]], если портабельность безсмысленна, там есть
regex по =~ (и Perl не понадобится).

> Но вообще-то первое же вхождение -ne в man bash дает оное описание.  Ну,
> в дебиановском man bash :)

man иногда слишком "короткий", если нужна некая bash-внутренность. Меня
спасал:

  /usr/share/doc/bash/CHANGES.gz

А так:

  $ aptitude search "?tag(doc)"  | grep -i bash
  2:i   abs-guide                       - The Advanced Bash-Scripting Guide
  60:i   bash-doc                        - Documentation and examples for the The GNU

  $ grep -i bash /usr/share/doc-base/*
  /usr/share/doc-base/abs-guide:2:Title: The Advanced Bash-Scripting Guide
  /usr/share/doc-base/ldp-en-bash-prog-intro-howto:2:Title: BASH Programming - Introduction HOWTO
  /usr/share/doc-base/ldp-en-bash-prompt-howto:2:Title: Bash Prompt HOWTO
  /usr/share/doc-base/ldp-en-from-powerup-to-bash-prompt-howto:2:Title: From Power Up To Bash Prompt

-- 
Best regards!


Reply to: