LoginSignup
52
29

More than 5 years have passed since last update.

bashでシングルクォートをエスケープする方法

Posted at

例えば、abc'deのような文字列をechoしたい場合、

ダメな例

$ echo 'adb\'de'
>

OKな例

$ echo 'abc'\''de'
abc'de

'abc'で一回文字列を終了し、\'でエスケープします。
その後、'de'で文字列を再開します。

52
29
1

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
52
29