Talk:Bourne Shell Scripting/Variable Expansion

I think the command $echo {HOME##*/}

is a bash command, rather than sh. I am currently looking for the sh equivalent of this (but may resort to simply using bash).

Colon in variable expansion
The colon in ${varname:-} is not optional. The expansion is different depending whether or not there is a colon.

$(varname:-default} means substitute default is varname is empty or unset.

$(varname-default} means substitute default if varname is unset.