getconf is 1) bash-only, 2) buggy
- bash-only
More specifically:
ret="${ret//\\*/__star__}"
(commented: "replace * with %, so that it is not globbed")
Either forget about /bin/sh and allow bash-ism everywhere (IMHO the best option) Either fix it to make it compatible with /bin/sh
- bugged : " (as an example) get replaced with star Because quoted "${ret//*/star}" replace the "*" rather than simply "*"
ret='*'; echo "${ret//\\*/__star__}" # output * which is not stripped ret='\*'; echo "${ret//\\*/__star__}" # outputs __start__ because of the \ prefix ret='\'; echo "${ret//\\*/__star__}" # outputs __start__ because it applies to \ ret='\abcd'; echo "${ret//\\*/__star__}" # outputs __start__ because it applies up to EO
The expression, if it should ever exist, should be
${ret//\*/__star__}
(escaping with one \ the *)
(from redmine: created on 2016-03-18)
Edited by Guillaume Subiron