head コマンドオプションと man ファイルの読み込み

head コマンドオプションと man ファイルの読み込み

MacとLinuxの2つの環境があります。

私について知りたい注文する:

これを呼び出すと、テキストは2行だけ表示されます。

vim --version | head -2

私はこれをオンラインで見て走った。詳細については、ページにアクセスしましたが、両方ではないことを知りました。...でもない-2ページに直接使用して得られる可能性を説明する情報があります。ちょうど2行テキストメッセージ:

だから私の質問は次のようになります

  • マンページを誤って読んでいますか?
  • それでは、-2直接指定が可能であることをどのように知ることができますか?
  • それ以外の場合は、認識されたオプションは使用できません。ページ?
  • そうでない場合、どこで探すべきですか?全公開コマンドオプションはどうですか?
  • 他の人も多いですか?便利このような特性は客観的により良く、使いやすくなります。私は気づかず、-h出力や調査を完了できませんでした。ページ?

りんご

OS X v10.8.3(ビルド12D78)


Linux

GNU/Linux (カーネル 3.5.0-25-typ) Ubuntu 12.10

GNUコアユーティリティ8.12.197-032bb


ベストアンサー1

デフォルトでは、以前のバージョンとの互換性フラグが見つかりました。 (正直言って、それが存在するのか全く知りませんでした。)

マニュアルページから:

SEE ALSO
       The  full documentation for head is maintained as a Texinfo manual.  If the info and head programs
       are properly installed at your site, the command

              info coreutils 'head invocation'

coreutils情報ページの下部に:

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.  If your script must also run on hosts
that support only the obsolete syntax, it is usually simpler to avoid
`head', e.g., by using `sed 5q' instead of `head -5'.

An exit status of zero indicates success, and a nonzero value indicates failure.

おすすめ記事