From: Date: March 15 1999 3:46am Subject: Re: Error in script mysql.server List-Archive: http://lists.mysql.com/mysql/213 Message-Id: <199903150246.SAA14152@igc3.igc.apc.org> >The script used for starting the server, file "mysql.server", doesn't work >properly. All values which are greped from configuration file might get used >"wrongly" by the script. A more robust and efficient (though rather verbose) method for parsing the config file would be e.g. set -f; oIFS="$IFS"; IFS="#=$IFS" set -- `grep "^user[ =]" $conf` IFS="$oIFS"; set +f; mysql_daemon_user="$2" This handles variable names that are subsets of other variablem names, arbitrary whitespace, and comments after the value. However, the value can't contain whitespace or '=' or '#'. To also support values with whitespace or '=' or '#' (while stripping leading and trailing whitespace), you can do (if you don't mind "line noise" code :-) mysql_daemon_user=`sed -n '/^user[ =]/s/^[^=]*=[ ]*\([^#]*[^ #]\)[ #]*.*$/\1/p' $conf` -scott