egscripts/egmakedbs/egcreatemycnf

34 lines
350 B
Text
Raw Normal View History

#!/bin/sh
usage() {
cat <<EOT
Usage: `basename $0` filename hostname username password
EOT
}
if [ $# -ne 4 ] ; then
usage
exit 1
fi
filename=$1
host=$2
user=$3
password=$4
if [ -e "$filename" ] ; then
echo "Refusing to overwrite $filename" >&2
fi
umask 077
cat <<EOT > $filename
[client]
host=$host
user=$user
password=$password
EOT