Here "${HOME:=}" is more or less no-op, since it returns $ HOME if it is installed, and nothing if it is not.
if [ "${HOME:=}" != "" ] && [ -d ${HOME} ]
This will work identically:
if [ "${HOME}" != "" ] && [ -d ${HOME} ]
If you had something after the equal sign, the first part of if always be true.
if [ "${HOME:=here}" != "" ] && [ -d ${HOME} ]
no matter what happens, you always get a string not equal to "".
However, this will depend on whether the values โโof $ HOME and $ DEFAULT were zero:
if [ "${HOME:=$DEFAULT}" != "" ] && [ -d ${HOME} ]
Dennis williamson
source share