[PLUG] another bash question

Shannon C. Dealy dealy at deatech.com
Tue Aug 6 20:18:56 UTC 2002


On Tue, 6 Aug 2002, Richard Kurth wrote:

[snip]
> I changed it to look like this
> A=$(uname -n)
> sed -e '/ServerName localhost/c\
> ServerName "$A"\   #<-I added the double quotes
> ' < httpd.conf
>
> And this is what it looks like when it writes to the httpd.conf file
> ServerName "$A"
> It is not filling in the variable with what is in the variable.

You need it around the whole string, replace your single quotes with
double quotes, the problem is the single quotes which supress
interpretation of the contents of the string between them.  In other
words, this:

 sed -e "/ServerName localhost/c\
 ServerName $A\
 " < httpd.conf


Shannon C. Dealy      |               DeaTech Research Inc.
dealy at deatech.com     |          - Custom Software Development -
                      |    Embedded Systems, Real-time, Device Drivers
Phone: (800) 467-5820 | Networking, Scientific & Engineering Applications
   or: (541) 451-5177 |                  www.deatech.com





More information about the PLUG mailing list