Linux Accent-graveコマンドは何をしますか? [コピー]

Linux Accent-graveコマンドは何をしますか? [コピー]

Bashシェル(A)で`(accent-grave)と入力すると、別のシェルプロンプト(B)が起動します。 Bに入力されたコマンドの出力はAのコマンドです。

$ `
> whoami`
-bash: Joe: command not found

(私のユーザー名がJoeの場合)

$ man `
> `
What manual page do you want?

これに関するマニュアルページはありますか?好ましくは、いくつかの例が含まれているか?

ベストアンサー1

bashのマニュアルにあります。検索backquote(置換)

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 sub‐
stitution.  When using the $(command) form, all characters between  the
parentheses make up the command; none are treated specially.

Command substitutions may be nested.  To nest when using the backquoted
form, escape the inner backquotes with backslashes.

$()特に物を入れ子にするときに使いやすいです。

おすすめ記事