Hi i want to use a simple "healthcheck" for docker in bash like this:
while ["$(docker exec -it ${mysql_name} mysql -u${mysql_user} -p${mysql_user_password} -e "SHOW DATABASES;" | grep ${mysql_name})" != ${mysql_name}]
do
sleep 1
echo "waiting for database..."
done
but i only get "mysql/test.sh: line 21: $'| nextcloud_db |\r': command not found". So it seems like bash is trying to output grep and I have no idea :(
"| nextcloud_db |" ist the output of the cmd in while
the single docker cmd + grep works
edit: maybe its better to check if grep is true? (and not this "!= ${mysql_name}"(btw. this will not working i guess, its not " string is not equal to var" its "string contains var"))