How to auto login in MySQL from a shell script?

Alternative ways to write these options. You can write mysql -u “$MYSQL_ROOT” -p”$MYSQL_PASS” -e “SHOW DATABASES” If [password is] given, there must be no space between –password= or -p and the password following it. If no password option is specified, the default is to send no password. to pass empty strings as separate arguments. Your … Read more

Dockerfile: how to set env variable from file contents

Environment Variables If you want to set a number of environment variables into your docker image (to be used within the containers) you can simply use env_file configuration option in your docker-compose.yml file. With that option, all the entries in the .env file will be set as the environment variables in image and hence into … Read more

Achieve Local Function

Bash does not support local functions, but depending on your specific script and architecture you can control the scope of your function name through subshells. By replacing the {..} with (..) in your definition, you’ll get the output you want. The new definition of usage will be limited to the function, but so will e.g. … Read more

tech