Explain How ":=" works in shell scrpting

Hi ,
can any one explain how in the below code ":=" working in shell programming.

 
L_DEBUG=${L_DBG:=N}
if [ ${L_DEBUG} = Y ]; then
  set -x
fi

Thanks
muddasas

Hi.

I think the shell man page can explain it better than me :slight_smile:

ksh description:

bash description:

${parameter:=word}
              Assign Default Values.  If parameter is unset or null, the expansion of word is assigned  to  parameter.
              The  value  of  parameter  is then substituted.  Positional parameters and special parameters may not be
              assigned to in this way.

Double post of:

Thread closed