From: "W. Trevor King" <[email protected]>

>From sed(1):

  s/regexp/replacement/
    Attempt to match regexp against the pattern space.  If successful,
    replace that portion matched with replacement.  The replacement
    may contain the special character & to refer to that portion of
    the pattern space which matched, and the special escapes \1
    through \9 to refer to the corresponding matching sub-expressions
    in the regexp.

This means that the old expression (with unescaped ampersands) lead
to:

  source /etc/profile ##STARTX##STARTX su - ${first_user} -c startx

when we want:

  source /etc/profile && su - ${first_user} -c startx

with ${first_user} expanded in both cases.
---
 targets/support/livecdfs-update.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/livecdfs-update.sh 
b/targets/support/livecdfs-update.sh
index 77d694e..fda3e36 100644
--- a/targets/support/livecdfs-update.sh
+++ b/targets/support/livecdfs-update.sh
@@ -389,7 +389,7 @@ esac
 if [ -e /etc/startx ]
 then
        sed -i \
-               "s:##STARTX:source /etc/profile && su - ${first_user} -c 
startx:" \
+               "s:##STARTX:source /etc/profile \&\& su - ${first_user} -c 
startx:" \
                /root/.bashrc
 fi
 
-- 
1.8.2.rc0.16.g20a599e


Reply via email to