[aklug] Simple Way to Replace text in Source Code?

bryanm at gci.net bryanm at gci.net
Sun Sep 3 14:42:38 AKDT 2017


 You're in luck, Christopher.  The solution here is trivial.

The slash character is a traditional, but arbitrary, delimiter for sed
commands.
Swap it out for | or + or just about anything else, and the slashes in
/usr/local
won't conflict with anything.

--
Bryan Medsker
bryan at gnomon.xyz

----- Original Message -----
From: "Christopher Howard" 
To:"aklug at aklug.org" 
Cc:
Sent:Sat, 02 Sep 2017 18:56:29 -0800
Subject:[aklug] Simple Way to Replace text in Source Code?

 Hi list, I'm trying to package up a program I wrote in PicoLisp. One
 annoyance is that PicoLisp doesn't have a built-in load-path system
 (and I didn't want to make one right now) meaning that if I need to
 have the path to files hard-coded in when installing to arbitrary
 locations. So, I wanted to throw a command into the Makefile that
when
 I run make, it replaces load paths in the source with the $(PREFIX)
 that has been set.

 I've heard of "sed", but the challenge I'm running into there is that
 it seems if I do something like sed s/STUB/$(PREFIX)/, and prefix is
 like /usr/local, then you get sed s/STUB//usr/local/ which messes the
 command up. And escaping the PREFIX before-hand doesn't appeal to me.

 Does anybody have any suggestions for me? I want to keep the
 build/install system as simple as possible, but have to deal with
this
 issue.

 -- 
 https://qlfiles.net
 https://emailselfdefense.fsf.org/en/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.aklug.org/pipermail/aklug/attachments/20170903/621187cc/attachment.html>


More information about the aklug mailing list