Help us understand the problem. What is going on with this article?

sedのsコマンドの区切り文字について

例えばシェルスクリプトでパス書き換えするのに

PATH="aaa/bbb/ccc"
sed -i "s/src=\"hoge\"/src=\"${PATH}\"/g";

これだと変数展開されませんでした。

文字列としてスラッシュ含むような場合
sedの区切り文字に認識されてた様子。

区切り文字って別の文字使えたんですね...

sed -i "s:src=\"hoge\":src=\"${PATH}\":g";

これで展開できた
おわり。

komacchi
Warhammer 40kかWarhammer AoSを一緒にやりませんか? 出戻り底辺モデラー。ミロク持ちでスキートと銃猟。 最近はミニチュア塗ったり、ながめたりしてニヤニヤしています。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした