1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

シェルスクリプトにおける ダブルクォートとシングルクォートとバッククォートの扱い

Last updated at Posted at 2019-06-01

Linux CentOS7でシェルスクリプトを書き始めた初心者向けです。
戒めを込めてシングルクォート、ダブルクォート、バッククォートの扱いについて書き残しておきます。

‘:シングルクォート:囲った中身を文字列として出力する
“:ダブルクォート:囲った変数の中身を文字列として出力する
`:バッククォート:囲った変数の中身をコマンドとして処理し、その結果を出力する

ミスはgetoptsコマンドを使いオプション処理の過程でshiftコマンドを使ったときに発生しました。shift 数値 に対しシングルクォートを用いたためにエラーになりました。原因がわからず時間を食ってしまいました...

私と同じように参考書で見間違わないように....

1
2
0

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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?