EDITOR、PAGER、BROWSERの環境変数はどこから来たのですか?

EDITOR、PAGER、BROWSERの環境変数はどこから来たのですか?

私が見たとき、man bashこれらのどれも定義されていませんでした。しかし、オンラインでランダムに言及された投稿はどこから来たのですか?それとも単なるコンベンションですか?

ベストアンサー1

彼らは他のものと同様に慣習にすぎません。標準ではあまりにも広く使用されているので、使用は賢明ではない衝突する変数に属すると言われていますEDITORPAGERバラより第8章 第1節:

広く使用されているコマンドソルバーやアプリケーションで頻繁にエクスポートされる特定の変数と競合するのは賢明ではありません。

...
EDITOR
...
PAGER
...
VISUAL
...

様々なプログラムは、これらの様々な組み合わせを尊重します。

man 1 crontab(POSIX):

   The  following  environment  variables  shall  affect  the execution of
   crontab:

   EDITOR Determine the editor  to  be  invoked  when  the  -e  option  is
          specified.  The default editor shall be vi.

man 8 sudoedit:

 2.   The editor specified by the policy is run to edit the
      temporary files.  The sudoers policy uses the
      SUDO_EDITOR, VISUAL and EDITOR environment variables (in
      that order).  If none of SUDO_EDITOR, VISUAL or EDITOR
      are set, the first program listed in the editor
      sudoers(5) option is used.

man 1 man(POSIX):

ENVIRONMENT VARIABLES
   The following environment variables shall affect the execution of man:
...
   PAGER  Determine  an output filtering command for writing the output to
          a terminal. Any string acceptable as a command_string operand to
          the  sh  -c  command  shall  be valid. When standard output is a
          terminal device,  the  reference  page  output  shall  be  piped
          through  the command.  If the PAGER variable is null or not set,
          the command shall be either more or  another  paginator  utility
          documented in the system documentation.

マニュアルに記載されていないのは驚くべきことではありませんbash。なぜなら、私が考えることができるbash組み込み機能のどれも使用できないからです。しかし、彼らは他のユーティリティで広く使用されています。これら3つはただ一般的に使用されます。


この変数BROWSERはまたは同じレベルにありません。この変数は標準に言及されていません。ただし、次の一部のプログラムではこれを使用できます。EDITORPAGERman

man 1 man(Debian):

BROWSER
      If $BROWSER is set, its value is a colon-delimited list of  com-
      mands,  each  of  which  in  turn  is used to try to start a web
      browser for man --html.  In each command, %s is  replaced  by  a
      filename  containing  the HTML output from groff, %% is replaced
      by a single percent sign (%), and %c is replaced by a colon (:).

おすすめ記事