printf white space character in bash script

view full story

http://unix.stackexchange.com – How can the white space character be escaped in printf for the purpose of this script that currently runs in a Cygwin client? The line containing the whitespace (which by itself works from the command line as echo $SPC) is SPC=$(printf \\$(printf '%03o' 32)) In case you might wonder why, in this code I am trying to simulate an associative array such that it is not dependent on Bash 4+...would like this to be a generic example that theoretically can be run in virtually any bash environment. Here is the entire script: #!/bin/bash DEFAULT_INDEX="" LAST_INDEX=0 SPC=$(printf (HowTos)