$( ... ) コマンド内のコマンドの用語

$( ... ) コマンド内のコマンドの用語

update-wallpaper次のスクリプトがあります。

ln -s $(get-wallpaper-path) ~/.config/bg-manager/wallpaper

表現$( ... )は...何か...と呼ばれ、$()Googleでその記号を検索しましたが、Bingでは結果が出ませんでした。

「インラインコマンド」というフレーズは素晴らしいようですが、正式な用語のようには見えません。少なくとも私のお気に入りの検索エンジンではそうではありません。 「公式の」フレーズは何ですか?

ベストアンサー1

$(Bashページで検索して、ローカルコンピュータからこの情報を取得できますman

tomas@tomas-Latitude-E4200:~$ man bash | grep -A2 -B2 '$('
       If value is not given, the variable is assigned the null string.  All values undergo tilde expansion, parameter and variable expansion, command sub‐
       stitution, arithmetic expansion, and quote removal (see EXPANSION below).  If the variable has its integer attribute set, then value is evaluated as
       an  arithmetic  expression  even  if the $((...)) expansion is not used (see Arithmetic Expansion below).  Word splitting is not performed, with the
       exception of "$@" as explained below under Special Parameters.  Pathname expansion is not performed.  Assignment statements may also appear as argu‐
       ments  to  the  alias,  declare,  typeset, export, readonly, and local builtin commands.  When in posix mode, these builtins may appear in a command
--
       Command substitution allows the output of a command to replace the command name.  There are two forms:

              $(command)
       or
              `command`

       Bash  performs  the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing
       newlines deleted.  Embedded newlines are not deleted, but they may be removed during word splitting.  The command substitution $(cat  file)  can  be
       replaced by the equivalent but faster $(< file).

       When  the  old-style  backquote  form  of substitution is used, backslash retains its literal meaning except when followed by $, `, or \.  The first
       backquote not preceded by a backslash terminates the command substitution.  When using the $(command) form, all characters between  the  parentheses
       make up the command; none are treated specially.

--
       Arithmetic expansion allows the evaluation of an arithmetic expression and the substitution of the result.  The format for arithmetic expansion is:

              $((expression))

       The old format $[expression] is deprecated and will be removed in upcoming versions of bash.

-Aおよびパラメータにいくつ-Bかの調整が必要な場合があります。これらの設定は状況によって異なり、manページ自体、コンテンツ、および端末ディスプレイ(1行に表示される文字数)によって異なります。ですから、見えるものを見て、見たいことを考えなければなりません。

しかし、結果は有益かもしれません。以下は、最初のリストから抜粋した主な内容です。

       Command substitution allows the output of a command to replace the command name.  There are two forms:

              $(command)
       or
              `command`

おすすめ記事