Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Cc: "Marijn Schouten (hkBst)" <hkBst@g.o>
Subject: Re: [gentoo-dev] escaping variables in sed expressions
Date: Tue, 15 Apr 2008 15:35:55
Message-Id: 200804151135.51735.vapier@gentoo.org
In Reply to: [gentoo-dev] escaping variables in sed expressions by "Marijn Schouten (hkBst)"
1 On Tuesday 15 April 2008, Marijn Schouten (hkBst) wrote:
2 > Hi list,
3 >
4 > it seems I have been using some fragile sed expression and I'd like to tap
5 > the collective wisdom for avoiding doing that in the future.
6 >
7 > dev-scheme/slib-3.1.5-r1 currently does
8 >
9 > sed "s_prefix = /usr/local/_prefix = ${D}/usr/_" -i Makefile
10
11 ignoring the escape character (which is currently standardized in the tree as
12 a colon), expressions like this are inherently fragile due to makefile
13 changes. i tend to do:
14 sed -i '/^prefix[[:space:]]*=/s:=.*:=/usr' Makefile
15 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature