[PLUG] another bash question

Don Buchholz don at truedisk.com
Tue Aug 6 21:15:44 UTC 2002


Richard Kurth wrote:
> 
> Ok I removed the backslash after $A so it looks like this
> A=$(uname -n)
>  sed -e "/ServerName localhost/c\
>  ServerName $A
>  " < httpd.conf
> 
>  and I still get the
>  sed: -e expression #1, char 24: Extra characters after command
> 

doh!, I forgot about my shell-meta-character warning earlier.
The backslash is one of them ...

  A=$(uname -n)
  sed -e "/ServerName localhost/c\\
  ServerName $A
  " < httpd.conf


Futhurmore, compare these two (identical results):

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

  sed -e "/ServerName localhost/c\\
  ServerName $A" < httpd.conf
  
... to this one:

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


The latter gives you an extra blank line.




More information about the PLUG mailing list