function prettyPrint { str=$1 strarr=() for (( i=0; i<${#str}; i++ )); do strarr+=($(printf '%d\n' "'${str:$i:1}")) done for ((i=0;i<$height;i++)) do for j in "${strarr[@]}"; do printf "%s" "${a["$j,$i"]}" done printf "\n" done } prettyPrint $1