Eduard Bloch <[EMAIL PROTECTED]> writes:

> #include <hallo.h>
> * Leopold BAILLY [Tue, Feb 15 2005, 12:38:28AM]:
>
>> The use of "grep -v" should be more appropriate.
>
> Could you test the attached version?

I did and it works : the previous content of pap-secrets and chap-secrets is no
more lost.

But, for each execution, one more blank line is introduced in these files. This
is due to the s/// sed command that blanks the line but don't delete it.

I suggest you use the d command instead. See the attached patch for details.


Regards,
Léo.
--- pppoeconf.ori	2005-02-17 23:44:46.000000000 +0100
+++ pppoeconf	2005-02-17 23:45:06.000000000 +0100
@@ -309,10 +309,10 @@
   usernoslash=$(echo $user | sed -e 's,/,\\/,')
   case $? in
   0)
-    sed -e "s/^\"*$usernoslash\"* .*//" /etc/ppp/pap-secrets > "$sectempfile"
+    sed -e "/^\"*$usernoslash\"* .*/ d" /etc/ppp/pap-secrets > "$sectempfile"
     mv "$sectempfile" /etc/ppp/pap-secrets
     echo "\"$user\" * \"$pass\"" >> /etc/ppp/pap-secrets
-    sed -e "s/^\"*$usernoslash\"* .*//" /etc/ppp/chap-secrets > "$sectempfile"
+    sed -e "/^\"*$usernoslash\"* .*/ d" /etc/ppp/chap-secrets > "$sectempfile"
     mv "$sectempfile" /etc/ppp/chap-secrets
     echo "\"$user\" * \"$pass\"" >> /etc/ppp/chap-secrets
     ;;

Reply via email to