Change the line,
dbPassword=exam!ple#####
to,
dbPassword='exam!ple#####'
to avoid !
(history-expansion) being treated specially in bash
From man bash
under QUOTING
sub-section,
When the command history expansion facilities are being used (see HISTORY EXPANSION below), the history expansion character, usually !, must be quoted to prevent history expansion.
more under HISTORY EXPANSION
History expansions are introduced by
the appearance of the history expansion character, which is ! by
default. Only backslash (
) and single quotes can quote the history
expansion character.
Also, it is a good practice to quote all your name-value
pairs to prevent Word-splitting done by shell.
sh home/example.sh --context_param dbUserName="username" --context_param dbPassword='exam!ple#####' --context_param resultDate="2017-01-13"
About word-splitting, from the man
page,
Word Splitting
The shell scans the results of parameter expansion, command substitution, and arithmetic expansion that did not occur within double quotes for word splitting. The shell treats each character of IFS
as a delimiter, and splits the results of the other expansions into words using these characters as field terminators
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…