Answer the question
In order to leave comments, you need to log in
How to escape minus (hyphen) and bash?
Good afternoon.
I'm trying to build a Docker Container with a couple of ENV variables that I want to use later in php-fpm.
Variables with "-" in names look like this
ENV F3-ENV-DB_USER=**RANDOM** \
F3-ENV-DB_NAME=**RANDOM**\
F3-ENV-DB_PASS=**RANDOM**\
F3-ENV-SMTP_HOST=mail\
F3-ENV-SMTP_PORT=587\
F3-ENV-SMTP_SCHEME=TLS\
F3-ENV-SMTP_USER=noreply\
F3-ENV-SMTP_PASS=**RANDOM**\
F3-ENV-SMTP_FROM=noreply
if [ "$F3-ENV-DB_PASS" = "**Random**" ]; then
unset F3-ENV-DB_PASS
fi
PASS=${F3-ENV-DB_PASS:-$(pwgen -s 12 1)}
_word=$( [ ${F3-ENV-DB_PASS} ] && echo "preset" || echo "random" )
echo "=> Creating MySQL user ${F3-ENV-DB_USER} with ${_word} password"
env | sed "s/\(.*\)=\(.*\)/fastcgi_param \1 '\2';/" > /etc/php/7.0/fpm/pool.d/www.conf
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question