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

Re: почему глючит ls



On 2016-01-22 0004 (+0200), Melleus wrote:
Mikhail A Antonov <mikhail@antfam.ru> writes:

а так?
ls -- *.pdf

Так все прекрасно работает, правда не совсем понятно почему, в мане не
нашел такой опции.

Ноги растут из POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/

Guideline 10:
      The first -- argument that is not an option-argument should be
      accepted as a delimiter indicating the end of options. Any following
      arguments should be treated as operands, even if they begin with the
      '-' character.

Вероятно, имеются файлы, имя которых начинается с '-'. При запуске с
*.pdf шелл разворачивает имена, и ls считает, что ему дают опцию
-somefile.pdf. Использование '-- ' позволяет обойти это.


Reply to: