Install script

Hi,

During an install script I modify the config file several times renamed as conffile.cfg_new. Each time I need to restore it to conffile.cfg.

INSTALLDIR=/app/MyAPP
USERNAME=bianca

RESTORE='rename conffile.cfg_new conffile.cfg ${INSTALLDIR}/conffile.cfg_new'
#example
    sed -e "/\[Service\]/,/^[^#][:space:]*UserName =/ s-\(^[^#][:space:]*UserName = \)\([^#]*\)-\1$USERNAME-1" \
        $CFGFILE > "${CFGFILE}_new"
$RESTORE

And call $RESTORE each time I modify the file (with sed awk etc)

But the RESTORE variable doesn't take the value of the ${INSTALLDIR} and the rename is not done.

Thank,
Bianca

You are using single quote, which will not interpret value of ${INTSTALLDIR}.

Either use double quotes or use backslash like \${INTSTALLDIR}.

Please update you still have problem.

Link: UNIX Shell Quote

Thank you for the solution and for the link.

Have a nice day,
Bianca