MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Scott Weikart Date:March 15 1999 2:46am
Subject:Re: Error in script mysql.server
View as plain text  
>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'

Error in script mysql.servertymiwi14 Mar
Re: Error in script mysql.serverScott Weikart15 Mar