Speaking as a bash newbie I have been upgrading my .bashrc via copy/paste + github and I have come across the :
command that stumps both me and google. e.g. : ${USER_BASH_COMPLETION_DIR:=~/.bash_completion.d}
.
Without this statement originally in my .bashrc, and typing this stuff into my terminal (-> indicates relevant output):
: ${USER_BASH_COMPLETION_DIR=~/.bash_completion.d}
echo $USER_BASH_COMPLETION_DIR
-> /Users/sh/.bash_completion.d
And:
: ${USER_BASH_COMPLETION_DIR=~/.bash_completion.d}
export USER_BASH_COMPLETION_DIR=asdf
echo $USER_BASH_COMPLETION_DIR
-> asdf
But:
: ${USER_BASH_COMPLETION_DIR=~/.bash_completion.d}
export USER_BASH_COMPLETION_DIR=asdf
: ${USER_BASH_COMPLETION_DIR=~/.bash_completion.d}
echo $USER_BASH_COMPLETION_DIR
-> asdf
I don't get it!
1) How does the colon command set a variable but cannot overwrite one set by export
?
2) What is the logic behind using :
in some .bashrc?
Using Mac 10.6.8
(out of context include of keyword colon just to help others like me who tried to search for that term)