I have seen the following syntax in a Bash script:
#!/usr/bin/env bash
: "${REDIS_HOST:="redis"}"
: "${REDIS_PORT:="6379"}"
: "${REDIS_PASSWORD:=""}"
What is the difference to this syntax?
#!/usr/bin/env bash
REDIS_HOST="redis"
REDIS_PORT="6379"
REDIS_PASSWORD=""
Is it a simple check such that the variable gets assigned a value if and only if the value of the variable is null before assignment? Why do we need the colon at the start of the line?