|
|
Line 1,257: |
Line 1,257: |
|
| |
|
| == PROMPTING == | | == PROMPTING == |
| When executing interactively, bash displays the primary prompt PS1 when it is ready to read a
| | 対話的に実行する場合、bashはコマンドを読み込む準備ができたときにプライマリプロンプトPS1を表示し、コマンドを完了するためにさらに入力が必要なときにセカンダリプロンプトPS2を表示する。 Bashはコマンドを読み込んだ後、実行する前にPS0を表示する。 Bashは、-xオプションが有効な場合、各コマンドをトレースする前に上記のようにPS4を表示する。 Bashでは、バックスラッシュでエスケープされた特殊文字を挿入することで、これらのプロンプト文字列をカスタマイズすることができる: |
| command, and the secondary prompt PS2 when it needs more input to complete a command. Bash dis‐
| | ;\a |
| plays PS0 after it reads a command but before executing it. Bash displays PS4 as described above
| | :ASCIIのベル文字(07) |
| before tracing each command when the -x option is enabled. Bash allows these prompt strings to
| | ;\d |
| be customized by inserting a number of backslash-escaped special characters that are decoded as
| | :"Weekday Month Date"形式の日付(例:"Tue May 26") |
| follows:
| | ;\D{format} |
| \a an ASCII bell character (07)
| | :formatは'''[https://manpages.debian.org/unstable/manpages-dev/strftime.3.en.html strftime]'''(3)に渡され、その結果がプロンプト文字列に挿入される。 中括弧は必須である。 |
| \d the date in "Weekday Month Date" format (e.g., "Tue May 26")
| | ;\e |
| \D{format}
| | :ASCIIエスケープ文字(033)である。 |
| the format is passed to strftime(3) and the result is inserted into the prompt
| | ;\h |
| string; an empty format results in a locale-specific time representation. The
| | :最初の`.'までのホスト名 |
| braces are required
| | ;\H |
| \e an ASCII escape character (033)
| | :ホスト名 |
| \h the hostname up to the first `.'
| | ;\j |
| \H the hostname
| | :shell が現在管理しているジョブ数 |
| \j the number of jobs currently managed by the shell
| | ;\l |
| \l the basename of the shell's terminal device name
| | :シェルの端末デバイス名のベースネーム |
| \n newline
| | ;\n |
| \r carriage return
| | :改行する |
| \s the name of the shell, the basename of $0 (the portion following the final slash)
| | ;\r |
| \t the current time in 24-hour HH:MM:SS format
| | :キャリッジリターン |
| \T the current time in 12-hour HH:MM:SS format
| | ;\s |
| \@ the current time in 12-hour am/pm format
| | :shell の名前、$0 のベースネーム(最後のスラッシュに続く部分) |
| \A the current time in 24-hour HH:MM format
| | ;\t |
| \u the username of the current user
| | :現在の時刻をHH:MM:SSの24時間形式で表示する。 |
| \v the version of bash (e.g., 2.00)
| | ;\T |
| \V the release of bash, version + patch level (e.g., 2.00.0)
| | :現在の時刻を12時間HH:MM:SS形式で表示する。 |
| \w the current working directory, with $HOME abbreviated with a tilde (uses the value
| | ;\@ |
| of the PROMPT_DIRTRIM variable)
| | :現在時刻を12時間表示のam/pmで表示する。 |
| \W the basename of the current working directory, with $HOME abbreviated with a tilde
| | ;\A |
| \! the history number of this command
| | :現在時刻を24時間表示する。 |
| \# the command number of this command
| | ;\u |
| \$ if the effective UID is 0, a #, otherwise a $
| | :現在のユーザーのユーザー名 |
| \nnn the character corresponding to the octal number nnn
| | ;\v |
| \\ a backslash
| | :bash のバージョン(例:2.00) |
| \[ begin a sequence of non-printing characters, which could be used to embed a termi‐
| | ;\V |
| nal control sequence into the prompt
| | :bash のリリース、バージョン+パッチレベル(例:2.00.0) |
| \] end a sequence of non-printing characters
| | ;\w |
| | :$HOME をチルダで省略した現在の作業ディレクトリ ('''PROMPT_DIRTRIM''' 変数の値を使用する) |
| | ;\W |
| | :現在の作業ディレクトリのベースネーム |
| | ;\! |
| | :このコマンドの履歴番号 |
| | ;\# |
| | :このコマンドのコマンド番号 |
| | ;\$ |
| | :有効UIDが0の場合は#、それ以外は$である |
| | ;\nnn |
| | :8進数のnnnに対応する文字。 |
| | ;\\ |
| | :バックスラッシュ |
| | ;<nowiki>\[</nowiki> |
| | :プロンプトに端末制御シーケンスを埋め込むために最初につける |
| | ;<nowiki>\]</nowiki> |
| | :印字しない文字のシーケンスを終了する。 |
|
| |
|
| The command number and the history number are usually different: the history number of a command
| | コマンド番号とヒストリ番号は通常異なる。コマンドのヒストリ番号はヒストリリスト内の位置で、ヒストリファイルから復元されたコマンドを含むことがある(下記の[[#HISTORY|HISTORY ]]を参照)。 文字列はデコードされた後、promptvarsシェルオプションの値に従って、パラメータ展開、コマンド置換、算術展開、引用符除去によって展開される(以下の[[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]]のshoptコマンドの説明を参照のこと)。 これは、文字列のエスケープされた部分がコマンド置換の中に現れたり、単語展開に特殊な文字を含んでいたりすると、望ましくない副作用をもたらす可能性がある。 |
| is its position in the history list, which may include commands restored from the history file
| |
| (see HISTORY below), while the command number is the position in the sequence of commands exe‐
| |
| cuted during the current shell session. After the string is decoded, it is expanded via parame‐
| |
| ter expansion, command substitution, arithmetic expansion, and quote removal, subject to the
| |
| value of the promptvars shell option (see the description of the shopt command under SHELL
| |
| BUILTIN COMMANDS below). This can have unwanted side effects if escaped portions of the string
| |
| appear within command substitution or contain characters special to word expansion.
| |
|
| |
|
| == READLINE == | | == READLINE == |