Re: почему глючит ls
On 2016-01-22, Vasiliy P. Melnik wrote:
> > а так?
> > ls -- *.pdf
>
> Так все прекрасно работает, правда не совсем понятно почему, в мане не
> нашел такой опции. Спасибо огромное!
Как писали ране не нашли потому что:
$ man 1 ls
SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/ls>
or available locally via: info '(coreutils) ls invocation'
$ info '(coreutils) Common options'
‘--’
Delimit the option list. Later arguments, if any, are treated as
operands even if they begin with ‘-’. For example, ‘sort -- -r’
reads from the file named ‘-r’.
и у Вас ls/cp/mv/etc из GNU coreutils.
Далее POSIX.1-2008:
Shell & Utilities
1.4 Utility Description Defaults
Default Behavior: When this section is listed as "None.", it means that the
implementation need not support any options. Standard utilities that do not
accept options, but that do accept operands, shall recognize "--" as a first
argument to be discarded.
The requirement for recognizing "--" is because conforming applications need
a way to shield their operands from any arbitrary options that the
implementation may provide as an extension. For example, if the standard
utility foo is listed as taking no options, and the application needed to
give it a pathname with a leading <hyphen>, it could safely do it as:
foo -- -myfile
Тут текст конечно с оговорками, без прямого указания как работать с "--", но
по собраной POSIX chm неудобно искать другие упоминания.
--
http://defun.work/
Reply to: