Re: Problems with my simple write conf files method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I have never used this method per se, but in general in any script if you want to preserve the $ (dollar sign) or variable name you must use a backslash to preserve it. For example change your $CONF to \$CONF.  The $CONF should then be printed into your conf file.
KM

      From: Robert Moskowitz <rgm@xxxxxxxxxxxxxxx>
 To: centos@xxxxxxxxxx 
 Sent: Tuesday, February 21, 2017 10:50 AM
 Subject:  Problems with my simple write conf files method
   
I have been creating conf files and similar with the following method 
that I picked up (I think from psotfix docs):

cat <<EOF>>/etc/aliases || exit 1
root: youremail
EOF

See: http://medon.htt-consult.com/Centos7-armv7.html

But with postfixadmin I stumbled onto a problem.  The following:

cat <<EOF>/usr/share/postfixadmin/config.local.php || exit 1
<?php
$CONF['database_type'] = 'mysqli';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'xyz';
$CONF['database_name'] = 'postfix';

$CONF['configured'] = true;
?>
EOF

produces:

cat <<EOF>/usr/share/postfixadmin/config.local.php || exit 1
<?php
['database_type'] = 'mysqli';
['database_user'] = 'postfix';
['database_password'] = 'xyz';
['database_name'] = 'postfix';

['configured'] = true;
?>

That is the '$CONF' gets processed.

What can I do to avoid this (and any other 'gotchas') or can someone 
provide an alternative?

thanks

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos


   
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux