<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="ja"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta name="author" content="magicant"> <meta name="description" content="Yash の history 組込みコマンドについて"> <title>Yash マニュアル: history 組込みコマンド</title> <link rel="Contents" href="../index.html" title="目次"> <link rel="Prev" href="help.html" title="Help 組込みコマンド"> <link rel="Next" href="jobs.html" title="Jobs 組込みコマンド"> <link rel="Stylesheet" href="../style.css"> <div class="breadcrumb"><a href="../index.html">目次</a> > <a rel="Up" href="index.html">組込みコマンド一覧</a></div> <h1>History 組込みコマンド</h1> <p><dfn>History 組込みコマンド</dfn>は<a href="../interact.html#history">コマンド履歴</a>を編集します。 <h2 id="syntax">構文</h2> <ul> <li><code>history [-cF] [-d <var>項目</var>] [-s <var>コマンド</var>] [-r <var>ファイル</var>] [-w <var>ファイル</var>] [<var>個数</var>]</code> </ul> <h2 id="description">説明</h2> <p>History コマンドは<a href="../interact.html#history">コマンド履歴</a>の内容を編集・表示します。 <p>オプションが指定してある場合、history コマンドはそのオプションに従ってコマンド履歴の内容を編集します。複数のオプションがある場合は指定した順に処理します。 <p>オペランドで<var>個数</var>が与えられている場合、history コマンドはコマンド履歴の内容をその個数だけ標準出力に出力します。出力の形式は <a href="fc.html">fc コマンド</a>に準じます。 <p>オプションもオペランドも与えられていない場合、history コマンドはコマンド履歴の内容を全て標準出力に出力します。 <h2 id="options">オプション</h2> <dl> <dt><code>-c</code>, <code>--clear</code> <dd>コマンド履歴をすべて削除します。 <dt><code>-d <var>項目</var></code>, <code>--delete=<var>項目</var></code> <dd>指定した<var>項目</var>をコマンド履歴から削除します。<var>項目</var>の指定の仕方は <a href="fc.html#operands">fc コマンドの<var>始点</var>・<var>終点</var></a>オペランドと同じです。 <dt><code>-F</code>, <code>--flush-file</code> <dd>履歴ファイルを再構築します。 <dt><code>-s <var>コマンド</var></code>, <code>--set=<var>コマンド</var></code> <dd>コマンド履歴の最後の項目を削除し、代わりに指定した<var>コマンド</var>を追加します。 <dt><code>-r <var>ファイル</var></code>, <code>--read=<var>ファイル</var></code> <dd>指定した<var>ファイル</var>からコマンドを読み込み履歴に追加します。ファイルの内容は単なるテキストファイルとして解釈され、それぞれの行の内容が一つのコマンドとして追加されます。 <dt><code>-w <var>ファイル</var></code>, <code>--write=<var>ファイル</var></code> <dd>指定した<var>ファイル</var>に現在のコマンド履歴の内容を全て書き出します。既にあるファイルの内容は消去します。履歴は単なるテキストとして一行ずつ書き出します。 </dl> <h2 id="operands">オペランド</h2> <dl> <dt><var>個数</var> <dd>表示する履歴の個数です。 </dl> <h2 id="exitstatus">終了ステータス</h2> <p>エラーがない限り history コマンドの終了ステータスは 0 です。 <h2 id="notes">補足</h2> <p>POSIX には history コマンドに関する規定はありません。 <p><a href="../lineedit.html">行編集</a>の動作中は履歴の内容を変更することはできません。