Hi there,
currently I am writing a small installation script
for the GRASS 5 binary packages. It is nearly
complete, but I struggle with "sed" command.
I need a variable to be expanded within a sed call.
The following is *not* working:
--------------
#!/bin/sh
# GRASS 5 binary package installation tool
#... [cut]
PATH=/home/mypath
sed "s/\/usr\/local\/grass\-5.0b/${PATH}/g" $PATH/etc/monitorcap.orig > \
$PATH/etc/monitorcap
--------------
Idea is to change the paths within monitorcap to
user's preference automatically.
Any help is appreciated, thank you in advance
Markus Neteler
[Posted and mailed]
On Sun, Aug 29, 1999 at 10:24:29PM +0100, Markus Neteler wrote:
I struggle with "sed" command.
Shell programming and especially the antique quoting rules of
the bourne shell (inherited to csh, bash and all them) are though.
((Would be so nice if people would use "es" or "python" for this
kind of work, but both cannot resonably be demanded as prerequisites on
all machines.))
I need a variable to be expanded within a sed call.
The following is *not* working:
--------------
#!/bin/sh
# GRASS 5 binary package installation tool
#... [cut]
PATH=/home/mypath
sed "s/\/usr\/local\/grass\-5.0b/${PATH}/g" $PATH/etc/monitorcap.orig > \
Analysis:
First you change your PATH. How do you find sed?
Secondly you got additional slashes in your variable which sed cannot
digest.
Solution: use sed's magic substitute seperator
Any help is appreciated, thank you in advance
Look at my attached example.
Bernhard
--
Research Assistant, Geog Dept UM-Milwaukee, USA. (www.uwm.edu/~bernhard)
Association for a Free Informational Infrastructure (ffii.org)
(attachments)
probe (449 Bytes)