/usr/bin/bash: Difference between revisions

Line 1,939: Line 1,939:
;<nowiki>bind [-m keymap] keyseq:function-name</nowiki>
;<nowiki>bind [-m keymap] keyseq:function-name</nowiki>
;<nowiki>bind [-m keymap] keyseq:readline-command</nowiki>
;<nowiki>bind [-m keymap] keyseq:readline-command</nowiki>
:Display current readline key and function bindings, bind a  key  sequence  to  a  readline function  or  macro, or set a readline variable. Each non-option argument is a command as it would appear in .inputrc, but each binding or command must be passed as a separate  argument;  e.g.,  '"\C-x\C-r": re-read-init-file'.  Options, if supplied, have the following meanings:
:現在の readline キーと関数のバインディングを表示したり、キーシーケンスを readline 関数やマクロにバインドしたり、readline 変数を設定したりする。 オプション以外の各引数は、.inputrcに表示されるコマンドであるが、各バインディングまたはコマンドは、別の引数として渡されなければならない;例えば、'"˶-xC-r": re-read-init-file'.  オプションが与えられた場合、以下の意味を持つ:
::;-m keymap
::;-m keymap
:::Use keymap as the keymap to be affected by the  subsequent  bindings.  Acceptable keymap  names  are  emacs,  emacs-standard,  emacs-meta,  emacs-ctlx,  vi, vi-move, vi-command, and vi-insert.  vi is equivalent to vi-command (vi-move is also a  synonym); emacs is equivalent to emacs-standard.
:::後続のバインディングの影響を受けるキーマップとしてkeymapを使う。 使用可能なキーマップ名は、emacs、emacs-standard、 emacs-meta、emacs-ctlx、vi、vi-move、vi-command、vi-insertである。 viはvi-commandと等価であり(vi-moveも同義語である)、emacsは emacs-standardと等価である。
::;-l
::;-l
:::List the names of all readline functions.
:::すべてのreadline関数の名前を列挙する。
::;-p
::;-p
:::Display  readline  function  names  and bindings in such a way that they can be re-read.
:::readlineの関数名とバインディングを、再読込できるように表示する。
::;-P
::;-P
:::List current readline function names and bindings.
:::現在のreadline関数名とバインディングをリストアップする。
::;-s
::;-s
:::Display readline key sequences bound to macros and the strings they output in  such a way that they can be re-read.
:::マクロにバインドされたreadlineキーシーケンスと、それらが出力する文字列を、再読み取りできるように表示する。
::;-S
::;-S
:::Display readline key sequences bound to macros and the strings they output.
:::マクロにバインドされたreadlineキーシーケンスと、それらが出力する文字列を表示する。
::;-v
::;-v
:::Display readline variable names and values in such a way that they can be re-read.
:::リードラインの変数名と値を再読込できるように表示する。
::;-V
::;-V
:::List current readline variable names and values.
:::現在のリードライン変数の名前と値をリストアップする。
::;-f filename
::;-f filename
:::Read key bindings from filename.
:::ファイル名からキーバインディングを読み込む。
::;-q function
::;-q function
:::Query about which keys invoke the named function.
:::どのキーが指定された関数を呼び出すかを問い合わせる。
::;-u function
::;-u function
:::Unbind all keys bound to the named function.
:::指定された関数にバインドされているすべてのキーをアンバインドする。
::;-r keyseq
::;-r keyseq
:::Remove any current binding for keyseq.
:::keyseqの現在のバインディングを削除する。
::;-x keyseq:shell-command
::;-x keyseq:shell-command
:::Cause  shell-command to be executed whenever keyseq is entered.  When shell-command is executed, the shell sets the READLINE_LINE variable to the contents of the read‐line  line buffer and the READLINE_POINT and READLINE_MARK variables to the current location of the insertion point and the saved insertion point (the mark),  respectively.  If  the executed command changes the value of any of READLINE_LINE, READLINE_POINT, or READLINE_MARK, those new values will be reflected  in  the  editing state.
:::keyseqが入力されるたびにシェルコマンドを実行させる。 shell-commandが実行されると、シェルは'''READLINE_LINE'''変数に読み取り行バッファの内容を設定し、'''READLINE_POINT'''変数と'''READLINE_MARK'''変数にそれぞれ現在の挿入位置と保存された挿入位置(マーク)を設定する。 実行されたコマンドが'''READLINE_LINE'''、'''READLINE_POINT'''、'''READLINE_MARK'''のいずれかの値を変更した場合、それらの新しい値は編集状態に反映される。
::;-X
::;-X
:::List  all  key  sequences  bound to shell commands and the associated commands in a format that can be reused as input.
:::シェルコマンドにバインドされているすべてのキーシーケンスと、関連するコマンドを、入力として再利用できる形式でリストアップする。


The return value is 0 unless an unrecognized option is given or an error occurred.
:認識できないオプションが与えられるか、エラーが発生しない限り、戻り値は0である。


;break [n]
;break [n]
:Exit from within a for, while, until, or select loop.  If n is specified, break n  levels. n  must  be  ≥ 1.  If n is greater than the number of enclosing loops, all enclosing loops are exited.  The return value is 0 unless n is not greater than or equal to 1.
:for、while、until、selectループの中で終了する。 nが指定された場合、nレベルブレークする。nは1以上でなければならない。 nがループの数より大きい場合、すべてのループが終了する。 nが1以上でなければ、戻り値は0である。


;<nowiki>builtin shell-builtin [arguments]</nowiki>
;<nowiki>builtin shell-builtin [arguments]</nowiki>
:Execute the specified shell builtin, passing it arguments, and  return  its  exit  status. This is useful when defining a function whose name is the same as a shell builtin, retaining the functionality of the builtin within the function.  The cd builtin is commonly  redefined this way.  The return status is false if shell-builtin is not a shell builtin command.
:指定されたシェル組み込み関数に引数を渡して実行し、その終了ステータスを返す。これは、シェル組み込み関数と同じ名前の関数を定義し、関数内で組み込み関数の機能を保持する場合に便利である。 cd 組み込み関数は一般的にこの方法で再定義される。 shell-builtin がシェル組み込みコマンドでない場合、戻り値は false となる。


;<nowiki>caller [expr]</nowiki>
;<nowiki>caller [expr]</nowiki>
:Returns the context of any active subroutine call (a shell function or a  script  executed with  the . or source builtins).  Without expr, caller displays the line number and source filename of the current subroutine call.  If a non-negative integer is supplied  as  expr, caller  displays  the  line number, subroutine name, and source file corresponding to that position in the current execution call stack.  This extra information may be used, for example,  to  print a stack trace.  The current frame is frame 0.  The return value is 0 unless the shell is not executing a subroutine call or expr does not correspond to  a  valid position in the call stack.
:アクティブなサブルーチン呼び出し(シェル関数、.または source 組み込み関数で実行されるスクリプト)のコンテキストを返す。 expr を指定しないと、呼び出し元は現在のサブルーチン呼び出しの行番号とソースファイル名を表示する。 exprとして負でない整数が指定された場合、呼び出し元は、現在の実行呼び出しスタックのその位置に対応する行番号、サブルーチン名、およびソースファイルを表示する。 この追加情報は、スタックトレースを表示する場合などに使用できる。 シェルがサブルーチン呼び出しを実行していないか、exprがコールスタックの有効な位置に対応していない場合を除き、戻り値は0である。


;<nowiki>cd [-L|[-P [-e]] [-@]] [dir]</nowiki>
;<nowiki>cd [-L|[-P [-e]] [-@]] [dir]</nowiki>
:Change  the current directory to dir.  if dir is not supplied, the value of the HOME shell variable is the default.  Any additional arguments following dir are ignored.  The  variable CDPATH defines the search path for the directory containing dir: each directory name in CDPATH is searched for dir.  Alternative directory names in CDPATH are separated  by  a colon  (:).  A null directory name in CDPATH is the same as the current directory, i.e., ``.''If dir begins with a slash (/), then CDPATH is not used. The -P option causes  cd to  use  the physical directory structure by resolving symbolic links while traversing dir and before processing instances of .. in dir (see also the -P option to  the  set  builtin command);  the  -L option forces symbolic links to be followed by resolving the link after processing instances of .. in dir.  If .. appears in dir, it is processed by removing  the immediately previous pathname component from dir, back to a slash or the beginning of dir. If the -e option is supplied with -P, and the current working directory cannot be successfully  determined after a successful directory change, cd will return an unsuccessful status.  On systems that support it, the -@ option presents the extended  attributes  associated  with a file as a directory.  An argument of - is converted to $OLDPWD before the directory change is attempted.  If a non-empty directory name from CDPATH is used, or  if  - is  the  first  argument, and the directory change is successful, the absolute pathname of the new working directory is written to the standard output.  The return value is true  if the directory was successfully changed; false otherwise.
:dirが与えられない場合、'''HOME'''シェル変数の値が デフォルトとなる。 dirに続く追加の引数は無視される。 変数'''CDPATH'''は、dirを含むディレクトリの検索パスを定義する。 '''CDPATH'''内の代替ディレクトリ名は、コロン(:)で区切られる。 '''CDPATH'''内のディレクトリ名がNULLの場合、カレントディレクトリと同じ、つまり ``.  dirがスラッシュ(/)で始まる場合、'''CDPATH'''は使われない。 -Pオプションをつけると、cdはdirを走査している間、dir中の...のインスタンスを処理する前にシンボリックリンクを解決して物理的なディレクトリ構造を使用するようになる(set組み込みコマンドの-Pオプションも参照のこと)。 .がdirに現れた場合、dirから直前のパス名コンポーネントを削除し、スラッシュまたはdirの先頭に戻して処理される。-Pとともに-eオプションが与えられ、ディレクトリ変更に成功した後にカレント作業ディレクトリを正しく決定できない場合、cdは失敗ステータスを返す。 これをサポートするシステムでは、-@オプションは、ファイルに関連する拡張属性をディレクトリとして表示する。 引数-は、ディレクトリの変更を試みる前に$OLDPWDに変換される。 '''CDPATH'''から空でないディレクトリ名が使用された場合、または - が最初の引数で、ディレクトリ変更が成功した場合、 新しい作業ディレクトリの絶対パス名が標準出力に書き出される。 戻り値は、ディレクトリの変更が成功した場合は真、そうでない場合は偽である。


;<nowiki>command [-pVv] command [arg ...]</nowiki>
;<nowiki>command [-pVv] command [arg ...]</nowiki>
:Run command with args suppressing the normal shell function lookup.  Only builtin commands or commands found in the PATH are executed.  If the -p option is  given,  the  search  for command  is performed using a default value for PATH that is guaranteed to find all of the standard utilities.  If either the -V or -v option is supplied, a description  of  command is printed.  The -v option causes a single word indicating the command or filename used to invoke command to be displayed; the -V option produces a more verbose description.  If the -V  or -v option is supplied, the exit status is 0 if command was found, and 1 if not.  If neither option is supplied and an error occurred or command cannot be found, the exit status  is 127.  Otherwise, the exit status of the command builtin is the exit status of command.
:通常のシェル関数検索を抑制して、argsでコマンドを実行する。 組み込みコマンドまたは '''PATH''' で見つかったコマンドのみが実行される。 -pオプションが与えられると、標準ユーティリティがすべて見つかることが保証されている'''PATH'''のデフォルト値を用いてコマンドの検索が行われる。 -Vまたは-vオプションが与えられると、コマンドの説明が表示される。 -vオプションを指定すると、コマンドを呼び出すために使用されたコマンドまたはファイル名を示す単一の単語が表示される。 -Vまたは-vオプションが指定された場合、コマンドが見つかれば終了ステータスは0になり、見つからなければ1になる。 どちらのオプションも指定されず、エラーが発生したかコマンドが見つからなかった場合、終了ステータスは127となる。 それ以外の場合は、コマンド組み込み関数の終了ステータスが command の終了ステータスになる。


;<nowiki>compgen [option] [word]</nowiki>
;<nowiki>compgen [option] [word]</nowiki>