First of all

R.T.F.M!

  • Emacs user: M-x info RET and find section “Bash”,and then RTFM.

  • Non-Emacs user: info bash

Variable assigning

a="hello"
b="${a:-world}"
c="${d:=world}"
echo ${a} $b $c $d

More references: https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion