LoginSignup
11
11

More than 5 years have passed since last update.

シェルにおける(シングルクオート、ダブルクオート、バッククオート)の違い

Posted at

変数をクオートで囲った時の挙動が異なります。

'(シングルクオート): 文字列として出力
"(ダブルクオート): 変数の中身を文字列として出力
`(バッククオート): 変数の中身をコマンドとして実行

$ ls
static templates app.py 
$ CMD="ls"
$ echo $CMD
ls
$ echo '$CMD'
$CMD
$ echo "$CMD"
ls
$ echo `$CMD`
static templates app.py
11
11
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11