Почему «head -3» дает те же результаты, что и «head -n 3»?

184
dhblah

Меня интересует, почему headработает так, как работает с заданными параметрами, т.е. head -3выдает тот же результат, что и head -n 3?

0

1 ответ на вопрос

4
slhck

From the Coreutils info pages for head (accessible through info coreutils 'head invocation'):

For compatibility head also supports an obsolete option syntax -COUNTOPTIONS, which is recognized only if it is specified first. COUNT is a decimal number optionally followed by a size letter (b, k, m) as in -c, or l to mean count by lines, or other option letters (cqv). Scripts intended for standard hosts should use -c COUNT or -n COUNT instead.

This is why the syntax is equivalent. man head doesn't tell you this, by the way.

Похожие вопросы